<template>
  <div>
    <el-dialog
      :close-on-click-modal="false"
      :title="title"
      :visible.sync="PMSobtain"
      :before-close="handleClose"
      width="70%"
      height="80%"
    >
      <el-form v-if="flg" :model="form">
        <el-form-item>
          <el-button type="primary" icon="el-icon-receiving" class="obtain"
            >获取</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        stripe
        :data="photovoltaicAccountData"
        :height="height"
        border
        style="width: 100%"
        v-loading="isLoading"
        header-cell-class-name="table_header"
        @selection-change="handleSelectionChange"
        row-key="id"
        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      >
        >
        <el-table-column type="selection" width="55"> </el-table-column>
        <template v-for="(item, index) in tableHeaderPhotovoltaicaccount">
          <el-table-column
            :prop="item.prop"
            :label="item.label"
            :min-width="item.width"
            :key="index"
          >
          </el-table-column>
        </template>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    PMSobtain: {
      type: Boolean, //类型
      required: true, //是否必须传入
    },
    title: {
      type: String,
      required: true,
    },
    flg: {
      type: Boolean,
      default: true,
    },
    photovoltaicAccountData: {
      type: [Array, Object],
      required: true,
    },
    tableHeaderPhotovoltaicaccount: {
      type: [Array, Object],
      required: true,
    },
  },
  data() {
    return {
      isLoading: false,
      device: "",
      height: "",
    };
  },
  created() {},

  mounted() {
   
    this.setHeight()
        window.addEventListener('resize', this.setHeight)
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.setHeight)
    },
    methods: {
        setHeight() {
          this.device = window.devicePixelRatio;
    this.height = window.sessionStorage.getItem("appheight") - 285;
          
        },
    // 表格多选
    handleSelectionChange(val) {
      this.multipleSelection = val;
      //console.log(this.multipleSelection);
    },

    handleClose(done) {
      this.$emit("Close");
    },
  },

  computed: {},

  watch: {
    PMSobtain(a, b) {
      console.log(a, b);
    },
  },
};
</script>

<style lang="less" scoped>
@import url("../../../styles/comStyle.less");
::v-deep .el-table .cell {
  text-align: center;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
  padding: 10px;
}
.pms {
  margin-left: 10px;
}
.obtain {
  margin-left: 1220px;
}
</style>
