<template>
  <div class="conent">
    <div class="btn">
      <el-button type="primary" @click="dialogVisible = true">新增</el-button>
    </div>

    <div class="from">
      <el-dialog title="新增用户" :visible.sync="dialogVisible" width="30%">
        <div>
          <el-form label-width="80px">
            <el-form-item label="ID">
              <el-input></el-input>
            </el-form-item>
            <el-form-item label="姓名">
              <el-input></el-input>
            </el-form-item>
            <el-form-item label="角色">
              <el-input></el-input>
            </el-form-item>
            <div class="from-btn">
              <el-button type="danger">取消</el-button>
              <el-button>确认</el-button>
            </div>
          </el-form>
        </div>
      </el-dialog>
    </div>

    <div class="table">
      <template>
        <el-table :data="tableList" style="width: 100%">
          <el-table-column prop="id" label="ID" width="400"> </el-table-column>
          <el-table-column prop="name" label="姓名" width="400">
          </el-table-column>
          <el-table-column prop="email" label="角色" width="400">
          </el-table-column>
          <el-table-column label="操作">
            <el-button>编辑</el-button>
            <el-button type="danger">删除</el-button>
          </el-table-column>
        </el-table>
      </template>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "GlxtUsers",

  data() {
    return {
      dialogVisible: false, //新增按钮变量
      tableList: [], //列表数据
    };
  },

  mounted() {
    //用户表单数据请求
    axios({
      method: "get",
      params: {},
      url: "http://doc.ii090.com/mock/267/api/users",
    }).then((res) => {
      this.tableList = res.data.data;
    });
  },
};
</script>

<style lang="scss" scoped>
.conent {
  width: 100%;
  min-height: calc(100vh - 200px);
  position: relative;
}
.btn {
  height: 104px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  .el-button {
    width: 114px;
    height: 44px;
    border-radius: 3px;
  }
}
.table {
  margin-top: 20px;
}

.from-btn {
  display: flex;
  justify-content: space-around;
  align-content: center;
}
</style>
