<template>
  <div class="manage-container">
    <el-row>
      <el-form ref="form" :model="form" label-width="100px">
        <vab-query-form>
          <el-form-item :label="$t('defalult.sj')">
            <el-date-picker
              type="month"
              :placeholder="$t('defalult.xzrq')"
            ></el-date-picker>
          </el-form-item>
          <el-form-item :label="$t('dataEnquiry.jd')">
            <el-select v-model="value" :placeholder="$t('dataEnquiry.qxzjd')">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('dataEnquiry.sq')">
            <el-select v-model="value" placeholder="请选择社区">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('dataEnquiry.zdmc')">
            <el-input
              v-model="queryForm.name"
              :placeholder="$t('dataEnquiry.qsrzdmc')"
            ></el-input>
          </el-form-item>
          <el-button type="primary" @click="search">
            {{ $t('defalult.cx') }}
          </el-button>
          <el-button type="primary" @click="search">
            {{ $t('defalult.chongz') }}
          </el-button>
          <el-button type="primary" @click="search">
            {{ $t('defalult.dc') }}
          </el-button>
        </vab-query-form>
      </el-form>
    </el-row>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column
        prop="id"
        :label="$t('trigger.xh')"
        width="150"
      ></el-table-column>
      <el-table-column
        prop="jiedao"
        label="所属街道"
        width="150"
      ></el-table-column>
      <el-table-column
        prop="shequ"
        label="所属社区"
        width="150"
      ></el-table-column>
      <el-table-column
        prop="mingcheng"
        :label="$t('dataEnquiry.zdmc')"
        width="150"
      ></el-table-column>
      <el-table-column label="11-01">
        <el-table-column
          prop="shuiliang"
          label="水量(m³)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dianliang"
          label="电量(Kw·h)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="nenghao"
          label="能耗(Kw·h/m³)"
          width="300"
        ></el-table-column>
      </el-table-column>
      <el-table-column label="11-02">
        <el-table-column
          prop="shuiliang"
          label="水量(m³)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dianliang"
          label="电量(Kw·h)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="nenghao"
          label="能耗(Kw·h/m³)"
          width="300"
        ></el-table-column>
      </el-table-column>
      <el-table-column label="11-03">
        <el-table-column
          prop="shuiliang"
          label="水量(m³)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dianliang"
          label="电量(Kw·h)"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="nenghao"
          label="能耗(Kw·h/m³)"
          width="300"
        ></el-table-column>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
// import { getList } from '@/api/group'

export default {
  data() {
    return {
      tableData: [
        {
          id: '1',
          jiedao: '工业园区',
          shequ: '和平社区',
          mingcheng: '顶上顶下',
          shuiliang: '123',
          dianliang: '213',
          nenghao: '1285',
        },
        {
          id: '1',
          jiedao: '工业园区',
          shequ: '和平社区',
          mingcheng: '顶上顶下',
          shuiliang: '123',
          dianliang: '213',
          nenghao: '1285',
        },
        {
          id: '1',
          jiedao: '工业园区',
          shequ: '和平社区',
          mingcheng: '顶上顶下',
          shuiliang: '123',
          dianliang: '213',
          nenghao: '1285',
        },
      ],
      lazy: true,
      activeName: 'first',
      layout: 'total, sizes, prev, pager, next, jumper',
      total: 0,
      input: '',
      textarea: '',
      list: [],
      background: true,
      listLoading: true,
      elementLoadingText: '正在加载...',
      queryForm: {
        page: 1,
        size: 20,
        name: '',
      },
    };
  },
  computed: {
    height() {
      return 500;
    },
  },
  created() {
    this.fetchData();
  },
  methods: {
    async fetchData() {
      this.listLoading = true;
      // const { data, total } = await getList(this.queryForm)
      // this.projectData = data.items
      // this.total = total
      // console.log(this.projectData)
      setTimeout(() => {
        this.listLoading = false;
      }, 500);
    },
    handleAdd() {
      this.$refs['edit'].showEdit();
    },
    handleEdit(row) {
      this.$refs['edit'].showEdit(row);
    },
    handleQuery() {
      this.queryForm.page = 1;
      this.fetchData();
    },
    handleSizeChange(val) {
      this.queryForm.size = val;
      this.fetchData();
    },
    handleCurrentChange(val) {
      this.queryForm.page = val;
      this.fetchData();
    },
    handleDelete(row) {
      // let that = this
      if (row.id) {
        this.$confirm('你确定要删除当前项吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
        })
          .then(() => {
            this.$message({
              type: 'success',
              message: '删除成功',
            });
            // const { msg } = doDelete({ groupId: row.id })
            // this.$message({
            //   type: 'success',
            //   message: msg == undefined ? '删除成功' : msg,
            // })
            // setTimeout(function () {
            //   that.fetchData()
            // }, 1000)
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除',
            });
          });
      }
    },
  },
};
</script>

<style lang="scss">
.el-submenu__title:hover {
  background-color: rgba(#1890ff, 0.085) !important;
  color: hsla(208, 100%, 55%, 0.95) !important;
}
</style>
