付延余
2022-04-12 1abe7ec44f4ce485ccf465aa6b00e1bc4b097b9c
src/pages/show/businessPolicy/BusinessPolicy.vue
@@ -68,8 +68,6 @@
            stripe
            :data="tableData"
            style="width: 100%"
            :max-height="tableHeight"
            :header-row-style="tableHeaderRow"
            :row-class-name="tableRowClassName"
            @row-click="tableRowClick"
          >
@@ -111,8 +109,7 @@
            stripe
            :data="tableData2"
            style="width: 100%"
            :max-height="tableHeight"
            :header-row-style="tableHeaderRow"
            max-height="1005"
            :row-class-name="tableRowClassName"
          >
            <el-table-column
@@ -174,7 +171,6 @@
    return {
      tableData: [
        {
          id: 1,
          keshi: "失业处",
          zhengchemingcheng: "失业保险稳岗返还政策",
          shengxiaoDate: "2021/3—2022/12",
@@ -423,52 +419,43 @@
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        },
        {
          tableTitle:
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        },
        {
          tableTitle:
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        },
        {
          tableTitle:
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        },
        {
          tableTitle:
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        },
        {
          tableTitle:
            "大力优化营商环境丨市人社局:服务提速提能 让百姓享受改革红利",
          laiyuan: "石家庄新闻",
          dianjiliang: "15690"
        }
      ],
      tableDialogVisible: false,
      tableHeight: window.innerHeight * 0.62
    };
  },
  mounted() {
    const that = this;
    window.onresize = () => {
      let height = window.innerHeight * 0.62;
      that.tableHieght = height;
      console.log(height);
    };
    // this.$nextTick(() => {
    //   this.tableHeight = window.innerHeight * 0.62;
    //   console.log(this.tableHeight);
    // });
    //
    // window.onresize = () =>
    //   (() => {
    //     window.screenWidth = document.body.clientWidth;
    //     that.screenWidth = window.screenWidth;
    //   })();
  },
  watch: {
    tableHeight(val) {
      // 为了避免频繁触发resize函数导致页面卡顿,使用定时器
      if (!this.timer) {
        // 一旦监听到的tableHeight值改变,就将其重新赋给data里的tableHeight
        this.tableHeight = val;
        this.timer = true;
        const that = this;
        setTimeout(function() {
          // that.sjcount(that.screenWidth); //窗口大小变化后执行的方法
          that.reload(); //窗口大小变化后执行的方法
          console.log(tableHeight);
          that.timer = false;
        }, 10);
      }
    }
  },
  methods: {
    tableHeaderRow({ rowIndex }) {
      if (rowIndex === 0) return { height: "8rem" };
    },
    tableRowClassName({ rowIndex }) {
      if (rowIndex % 2 === 0) {
        return "warning-row";
@@ -480,27 +467,26 @@
      console.log(row);
      console.log(row.__ob__.dep.id);
      console.log(row.id);
    },
    reload() {
      this.isAlive = false;
      this.$nextTick(function() {
        this.isAlive = true;
      });
    }
  }
};
</script>
<style lang="scss">
@import "../../../assets/css/base";
@import "../../../assets/css/mixin.scss";
// 表格
.BusinessPolicyTable {
  height:3.92578125rem;
  width: 4.5078rem;
  position: absolute;
  top: 0.2813rem;
  left: 0.1289rem;
  @include overflow-y();
  .el-table {
    background: transparent;
  }
  .el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell {
    background: none;
  }
  // 去掉当前行高亮背景颜色
  .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
@@ -522,17 +508,17 @@
    background: transparent;
  }
  .el-table--striped,
    .el-table__body,
    tr.el-table__row--striped,
    td.el-table__cell {
  .el-table__body,
  tr.el-table__row--striped,
  td.el-table__cell {
    background: transparent;
  }
  .el-table thead {
    color: #111111;
  }
  .el-table .el-table__cell {
    padding: 2rem 0;
  }
   .el-table .el-table__cell {
     padding: 0.0781rem 0;
   }
  .el-table__body tr.hover-row.current-row > td.el-table__cell,
  .el-table__body,
  tr.hover-row.el-table__row--striped.current-row,
@@ -589,8 +575,8 @@
}
</style>
<style lang="scss" scoped>
#businessPolicy {
}
// #businessPolicy {
// }
.upCentent {
  height: 0.8984rem;
  width: 9.6875rem;
@@ -668,6 +654,10 @@
        margin-left: 0.1445rem;
        margin-right: 0.0781rem;
      }
      img {
        width: 0.5313rem;
        height: 0.0625rem;
      }
    }
  }
}