<template>
  <div>
    <el-table v-loading="loading" :data="list" border>
      <el-table-column label="瞬时总流量" prop="flowsum" />
      <el-table-column label="水位" prop="waterlevel" />
      <el-table-column label="测流时间" prop="createTime" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="goRealTime(scope.row)">测流成果</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { listScatterPlot } from '@/api/analysis/achievement'

export default {
  props: {
    queryParams: Object,
  },
  data() {
    return {
      total: 0,
      list: [],
      loading: false,
    }
  },
  mounted() {
    this.getList();
  },
  watch: {
    queryParams: {
      handler() {
        this.getList();
      },
      deep: true,
    },
  },
  methods: {
    getList() {
      const { queryParams } = this;
      if (!queryParams.siteId) return;
      const params = {
        ...this.queryParams,
      };
      this.loading = true;
      listScatterPlot(params).then(response => {
          this.list = response.data;
          this.loading = false;
        }
      );
    },
    goRealTime(task) {
      this.$router.push(`/analysis/task/realtime/${task.siteId}?taskid=${task.taskid}`);
    },
  }
}
</script>

<style scoped>

</style>
