mapTable.vue 3.44 KB
<template>
  <div class="table">
    <el-table
      :data="tableData"
      border
      highlight-current-row
      :height="tableHeight"
      @selection-change="handleSelectionChange"
      @row-click="handleRowClick"
      ref="multipleTable"
      :header-cell-style="{ color: '#000000' }"
    >
      <!-- <el-table-column
        type="selection"
        align="center"
        width="55"
      ></el-table-column> -->
      <el-table-column
        v-for="(item, index) in tableCol"
        :key="index"
        :prop="item.prop"
        :label="item.label"
        :width="item.width"
        align="center"
      >
      </el-table-column>
      <el-table-column v-if="isDelete" fixed="right" label="操作" width="60">
        <template slot-scope="scope">
          <el-button
            @click.native.prevent="deleteRow(scope.$index, tableData)"
            type="text"
            size="small"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- <div class="pagination-container">
      <el-pagination
        style="margin-top: 15px"
        align="center"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="queryConfig.currentPage"
        :page-sizes="[20, 50, 100]"
        :page-size="queryConfig.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      />
    </div> -->
  </div>
</template>

<script>
export default {
  name: "mapControl",
  props: {},
  data() {
    return {
      tableCol: [],
      tableData: [],
      isDelete: false,
      tableHeight: "300px",
      multipleSelection: [],
      total: 0,
      //查询条件
      queryConfig: {
        currentPage: 1,
        pageSize: 20,
        code: "",
      },
    };
  },
  mounted() {},
  methods: {
    deleteRow(index, rows) {
      rows.splice(index, 1);
    },

    handleRowClick(row) {
      this.$refs.multipleTable.toggleRowSelection(row);
    },
    //获取表格行数据
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    handleCurrentChange(val) {
      this.queryConfig.currentPage = val;
      this.getTableList();
    },
    //分页
    handleSizeChange(val) {
      this.queryConfig.pageSize = val;
      this.queryConfig.currentPage = 1;
      this.getTableList();
    },
    //表格数据
    getTableList() {
      const params = {
        pageNumber: this.queryConfig.currentPage,
        perPageCount: this.queryConfig.pageSize,
        queryConfig: {
          code: this.queryConfig.code,
          name: this.queryConfig.name,
          typeId: this.queryConfig.typeId,
          ip: this.queryConfig.ip,
          destinationArea: this.queryConfig.destinationArea,
        },
      };
      this.listLoading = true;
      // GetEquipments(params).then((response) => {
      //   this.total = response.data.totalCount;
      //   response.data.data.forEach((x) => {
      //     if (x.disable == false) {
      //       x["isTree"] = this.$t("deviceManage.deny");
      //     } else {
      //       x["isTree"] = this.$t("deviceManage.disabled");
      //     }
      //   });
      //   this.tableData = response.data.data;
      //   this.listLoading = false;
      // });
    },
  },
};
</script>

<style lang="scss" scoped>
/* 修改复选框大小 */
.el-table .el-checkbox {
  transform: scale(1.8) !important; /* 调整大小 */
  margin-top: 5px;
}
.table {
  border: 1px solid #e5e9f2;
}
</style>