<template>
  <div
    v-loading.fullscreen.lock="fullscreenLoading"
    class="userManagement_list"
  >
    <div class="userManagement_list_headerSelect">
      <el-form slot="form" style="display: inline" inline :addList="true">
        <el-form-item class="header_top_form" label="账号：">
          <el-input placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item class="header_top_form" label="姓名：">
          <el-input placeholder="请输入" size="small"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" style="width: 88px"
            >查询</el-button
          >
        </el-form-item>
      </el-form>
      <el-button size="small" style="width: 104px; margin-right: 23px"
        >新增</el-button
      >
    </div>
    <el-table
      :data="tableData"
      style="width: 100%"
      stripe
      :header-cell-style="{ background: '#F7F7F7' }"
      height="66vh"
    >
      <el-table-column
        v-for="(item, index) in listData"
        :key="index"
        :label="item.name"
        :prop="item.value"
        :width="item.width"
        :min-width="item.minWidth"
        :align="item.align"
      >
        <template slot-scope="scope">
          <div>
            <div v-if="item.value == 'status'">
              <el-switch
                v-model="scope.row[scope.column.property]"
                active-color="#17A8FF"
                inactive-color="#AFAFAF"
              >
              </el-switch>
            </div>
            <div v-else>
              {{ scope.row[scope.column.property] }}
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <div>
            <el-button type="text" @click="edit(scope.row)">编辑</el-button>
            <el-button type="text" @click="resetPasswords(scope.row)"
              >重置密码</el-button
            >
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="form.pageNum"
      :page-sizes="[100, 200, 300, 400]"
      :page-size="10"
      background
      layout="total,prev, pager, next,jumper"
      :total="100"
    >
    </el-pagination>
    <editDialog ref="editDialogRefs" />
    <detailDialog ref="detailDialogRefs" />
  </div>
</template>
<script>
import editDialog from './edit'
import detailDialog from './detail'
export default {
  name: 'userManagement',
  components: {
    editDialog,
    detailDialog
  },
  data() {
    return {
      fullscreenLoading: false,
      tableData: [],
      listData: [
        { name: '账号', value: '', width: '', minWidth: '', align: 'center' },
        { name: '姓名', value: '', width: '', minWidth: '', align: 'center' },
        {
          name: '禁用/启用',
          value: '',
          width: '',
          minWidth: '',
          align: 'center'
        },
        {
          name: '创建时间',
          value: '',
          width: '',
          minWidth: '',
          align: 'center'
        }
      ],
      form: {
        pageNum: 4
      }
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.tableData = [{}]
    })
  },
  methods: {
    handleSizeChange() {},
    handleCurrentChange() {},
    // 编辑
    edit() {
      this.$refs.editDialogRefs.openClose()
    },
    // 重置密码
    resetPasswords() {
      this.$refs.detailDialogRefs.openClose()
    }
  }
}
</script>
<style lang="less">
.userManagement_list {
  .userManagement_list_headerSelect {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    .el-form-item {
      margin-bottom: 0;
      margin-right: 60px;
      .el-input__inner {
        background: #f5f5f5;
        opacity: 1;
        border-radius: 17px;
      }
    }
  }
}
</style>