|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<div class="batch_button">
|
|
|
<el-button class="export" @click="exportData">导出数据</el-button>
|
|
|
- <el-button class="activate" @click="batchActivate">批量激活</el-button>
|
|
|
+ <el-button class="activate" @click="batchActivate">批量禁用</el-button>
|
|
|
<el-button class="delete" @click="batchDelete">批量删除</el-button>
|
|
|
</div>
|
|
|
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" :header-cell-style="{ textAlign: 'center' }"
|
|
@@ -23,10 +23,9 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="operation" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button size="mini" type="text" style="color: #2ea8e6" @click="userDetail(scope.row)">查看</el-button>
|
|
|
- <el-button size="mini" type="text" style="color: #2ea8e6"
|
|
|
- @click="userInfoEdit(scope.row)">编辑</el-button>
|
|
|
- <el-button size="mini" type="text" style="color: #2ea8e6" @click="deleteUser(scope.row)">删除</el-button>
|
|
|
+ <el-button size="mini" type="text" style="color: #2ea8e6" v-show="scope.row.username == null ? false : true" @click="userDetail(scope.row)">查看</el-button>
|
|
|
+ <el-button size="mini" type="text" style="color: #2ea8e6" v-show="scope.row.username == null ? false : true" @click="userInfoEdit(scope.row)">编辑</el-button>
|
|
|
+ <el-button size="mini" type="text" style="color: #2ea8e6" v-show="scope.row.username == null ? false : true" @click="deleteUser(scope.row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -41,10 +40,16 @@
|
|
|
|
|
|
<script>
|
|
|
import page from '@/components/pagination/index';
|
|
|
-import { getUserList, deleteSingleUser, updateUserDetail } from '@/api/user/user';
|
|
|
+import { getUserList, getUserInfo, deleteSingleUser, updateUserInfo } from '@/api/user/user';
|
|
|
import UserDetail from '../messageDialog/userInfoDetail';
|
|
|
import userInfoEdit from '../messageDialog/userInfoEdit';
|
|
|
export default {
|
|
|
+ props: {
|
|
|
+ name: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
components: { page, UserDetail, userInfoEdit },
|
|
|
data() {
|
|
|
return {
|
|
@@ -57,7 +62,7 @@ export default {
|
|
|
pagerCount: 5,
|
|
|
currentPage: 1,
|
|
|
pageSizes: [5, 10, 20, 30],
|
|
|
- total: 30,
|
|
|
+ total: 0,
|
|
|
currentChange: (val) => {
|
|
|
this.getTableData(val);
|
|
|
},
|
|
@@ -82,12 +87,13 @@ export default {
|
|
|
},
|
|
|
getTableData(page) {
|
|
|
this.tableData = [];
|
|
|
- getUserList(0, page, this.currentPageSize).then((res) => {
|
|
|
+ getUserList(0, page, this.currentPageSize, this.name).then((res) => {
|
|
|
if (res.data.code === 0 && res.data.data.length > 0) {
|
|
|
this.paginationData.total = res.data.total;
|
|
|
this.tableData = res.data.data.map((e) => {
|
|
|
return {
|
|
|
- username: e.name,
|
|
|
+ id:e.id,
|
|
|
+ username: e.user_name,
|
|
|
phone: e.phone == "undefined" || !e.phone ? "--" : e.phone,
|
|
|
email: e.email == "undefined" || !e.email ? "--" : e.email,
|
|
|
role: e.role == "undefined" || !e.role ? "--" : e.role,
|
|
@@ -119,12 +125,17 @@ export default {
|
|
|
userInfoEdit() {
|
|
|
this.$refs.userInfoEdit.dialogVisible = true;
|
|
|
},
|
|
|
+
|
|
|
deleteUser(data) {
|
|
|
+
|
|
|
let options = {
|
|
|
- id: data.id,
|
|
|
+ id:data.id,
|
|
|
username: data.username,
|
|
|
- password: data.password,
|
|
|
+ password: getUserInfo(data.id).then((res) =>{
|
|
|
+ console.log(res);
|
|
|
+ }),
|
|
|
};
|
|
|
+ console.log(options);
|
|
|
deleteSingleUser(options).then((res) => {
|
|
|
if (res.data.code === 0) {
|
|
|
this.$message.success("删除成功");
|