<template>
  <div>
    <el-dialog
      :close-on-click-modal="false"
      :title="title"
      :visible.sync="PMSobtain"
      :before-close="handleClose"
      width="70%"
      height="80%"
    >
      <el-form :inline="true" class="demo-form-inline">
        <el-form-item>
          <el-button type="primary" icon="el-icon-receiving" class="obtain"
            >获取</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        stripe
        :data="Data"
        :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 Name">
          <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,
    },
    Data: {
      type: [Array, Object],
      required: true,
    },
    Name: {
      type: [Array, Object],
      required: true,
    },
  },
  data() {
    return {
      isLoading: false,
      device: "",
      height: "",
    };
  },
  created() {},

  mounted() {
    this.device = window.devicePixelRatio;

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

  computed: {},

  watch: {},
};
</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>
