|
|
@@ -1,8 +1,8 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
<el-table
|
|
|
- v-loading="listLoading"
|
|
|
- :data="list"
|
|
|
+ v-loading="isLoading"
|
|
|
+ :data="pageData.data"
|
|
|
element-loading-text="Loading"
|
|
|
border
|
|
|
fit
|
|
|
@@ -42,55 +42,109 @@
|
|
|
<el-tag>{{ scope.row.state.text }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
-
|
|
|
- <el-table-column label="注册时间">
|
|
|
+ <el-table-column label="注册时间" width="160">
|
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.registerTime }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
<el-table-column label="角色">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag v-for="role in scope.row.listRoles" :key="role.id">{{ role.name }}</el-tag>
|
|
|
+ <el-tag v-for="role in scope.row.listRoles" :key="role.id">{{ role.name }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="70" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-dropdown>
|
|
|
+ <el-button type="text">
|
|
|
+ 操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item>编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item @click.native="enabledByIds([scope.row.id])">启用</el-dropdown-item>
|
|
|
+ <el-dropdown-item @click.native="disableByIds([scope.row.id])">禁用</el-dropdown-item>
|
|
|
+ <el-dropdown-item @click.native="resetLoginPasswordByIds([scope.row.id])">重置登录密码</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
+ <el-pagination
|
|
|
+ class="pagination-container"
|
|
|
+ background
|
|
|
+ layout="prev, pager, next"
|
|
|
+ :total="pageData.total"
|
|
|
+ :page-size="pageData.pageSize"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { findPage } from "@/api/userInfo";
|
|
|
+import { findPage, enabledByIds, disableByIds, resetLoginPasswordByIds } from '@/api/userInfo'
|
|
|
|
|
|
export default {
|
|
|
- filters: {
|
|
|
- statusFilter(status) {
|
|
|
- const statusMap = {
|
|
|
- published: "success",
|
|
|
- draft: "gray",
|
|
|
- deleted: "danger",
|
|
|
- };
|
|
|
- return statusMap[status];
|
|
|
- },
|
|
|
- },
|
|
|
data() {
|
|
|
return {
|
|
|
- list: null,
|
|
|
- listLoading: true,
|
|
|
- };
|
|
|
+ isLoading: true,
|
|
|
+ pageData: {},
|
|
|
+ currentPage: 1
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
- this.fetchData();
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
+ this.currentPage = val
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ enabledByIds(ids) {
|
|
|
+ console.log(`当前页: ${ids}`)
|
|
|
+ this.$confirm('确认要启用吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ enabledByIds(ids).then(() => {
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ disableByIds(ids) {
|
|
|
+ console.log(`当前页: ${ids}`)
|
|
|
+ this.$confirm('确认要禁用吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ disableByIds(ids).then(() => {
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetLoginPasswordByIds(ids) {
|
|
|
+ this.$confirm('确认要重置吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ resetLoginPasswordByIds(ids).then((newPasswd) => {
|
|
|
+ this.$alert('新的登录密码为:' + newPasswd + ',请妥善保管', '登录密码重置成功', {
|
|
|
+ confirmButtonText: '确定'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
fetchData() {
|
|
|
- this.listLoading = true;
|
|
|
- findPage({})
|
|
|
+ this.isLoading = true
|
|
|
+ findPage({ current: this.currentPage })
|
|
|
.then((response) => {
|
|
|
- this.list = response.data;
|
|
|
+ this.pageData = response
|
|
|
})
|
|
|
- .finally(() => (this.listLoading = false));
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ .finally(() => (this.isLoading = false))
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|