<template>
  <div class="main">
    <el-table border :data="list" style="margin-top: 20px; width: 100%">
      <el-table-column prop="resolutionName" label="分辨率名称" align="center">
      </el-table-column>
      <el-table-column prop="resolution" label="分辨率标识" align="center">
      </el-table-column>
      <el-table-column prop="sort" label="排序" align="center">
      </el-table-column>

      <el-table-column label="状态" align="center">
        <template slot-scope="{ row }">
          <span v-if="row.status == 1">上架</span>
          <span v-if="row.status == 2">下架</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="{ row }">
          <el-row>
            <el-button type="text">编辑</el-button>
            <el-button type="text">删除</el-button>
          </el-row>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      style="margin-top: 20px"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="listQuery.page"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="listQuery.limit"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>
<script>
import { getResolutionData } from "api/website/archiveDataManagement";
export default {
  data() {
    return {
      list: [{}],
      total: 0,
      listQuery: {
        page: 1,
        limit: 10,
      },
    };
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      getResolutionData(this.listQuery).then((res) => {
        if (res.status == 200) {
          this.total = res.data.totalCount;
          this.list = res.data.data;
        }
      });
    },
    handleSizeChange(val) {
      this.listQuery.page = 1;
      this.listQuery.limit = val;
      this.getList();
    },
    handleCurrentChange(val) {
      this.listQuery.page = val;
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
.main {
  box-sizing: border-box;
  padding: 36px;
}
</style>
