|
@@ -1,16 +1,17 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" :header-cell-style="{ textAlign: 'center', fontSize: '14px' }"
|
|
|
- :cell-style="{ textAlign: 'center' }" style="width: 100%;min-height: 500px"
|
|
|
- @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="50"> </el-table-column>
|
|
|
- <el-table-column prop="username" label="用户名"> </el-table-column>
|
|
|
- <el-table-column prop="phone" label="手机号"> </el-table-column>
|
|
|
- <el-table-column prop="email" label="邮箱"> </el-table-column>
|
|
|
- <el-table-column prop="role" label="角色"> </el-table-column>
|
|
|
- <el-table-column prop="permission" label="权限"> </el-table-column>
|
|
|
- <el-table-column prop="working_address" label="单位"> </el-table-column>
|
|
|
- <el-table-column prop="register_time" label="注册时间" width="180"> </el-table-column>
|
|
|
+ <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark"
|
|
|
+ :header-cell-style="{ textAlign: 'center', fontSize: '14px' }"
|
|
|
+ :cell-style="{ textAlign: 'center' }" style="width: 100%;min-height: 500px"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="50"></el-table-column>
|
|
|
+ <el-table-column prop="username" label="用户名"></el-table-column>
|
|
|
+ <el-table-column prop="phone" label="手机号"></el-table-column>
|
|
|
+ <el-table-column prop="email" label="邮箱"></el-table-column>
|
|
|
+ <el-table-column prop="role" label="角色"></el-table-column>
|
|
|
+ <el-table-column prop="permission" label="权限"></el-table-column>
|
|
|
+ <el-table-column prop="working_address" label="单位"></el-table-column>
|
|
|
+ <el-table-column prop="register_time" label="注册时间" width="180"></el-table-column>
|
|
|
<el-table-column prop="status" label="状态">
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag :color="scope.row.status !== null || undefined ? '#06f77e' : '#757776'"></el-tag>
|
|
@@ -18,30 +19,33 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="operation" label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <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>
|
|
|
+ <el-button size="mini" type="text" style="color: #2ea8e6"
|
|
|
+ v-show="scope.row.username == null ? false : true" @click="view(scope.row)">查看
|
|
|
+ </el-button>
|
|
|
+ <el-button size="mini" type="text" style="color: #2ea8e6"
|
|
|
+ v-show="scope.row.username == null ? false : true" @click="edit(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>
|
|
|
<div class="bottom">
|
|
|
<page class="page" :paginationData="paginationData"></page>
|
|
|
</div>
|
|
|
- <!--弹窗-->
|
|
|
- <user-detail ref="userDetail"></user-detail>
|
|
|
- <userInfoEdit ref="userInfoEdit"></userInfoEdit>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import page from '@/components/pagination/index';
|
|
|
-import { getUserList, getUserInfo, deleteSingleUser, updateUserInfo } from '@/api/user/user';
|
|
|
-import UserDetail from '../messageDialog/userInfoDetail';
|
|
|
-import userInfoEdit from '../messageDialog/userInfoEdit';
|
|
|
+import {getUserList, getUserInfo, deleteSingleUser, updateUserInfo} from '@/api/user/user';
|
|
|
+
|
|
|
export default {
|
|
|
- components: { page, UserDetail, userInfoEdit },
|
|
|
+ components: {page},
|
|
|
props: {
|
|
|
active: String,
|
|
|
+ searchVal: String,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -64,11 +68,15 @@ export default {
|
|
|
},
|
|
|
};
|
|
|
},
|
|
|
+ emits: ['view', 'update', 'del'],
|
|
|
mounted() {
|
|
|
this.initData();
|
|
|
},
|
|
|
methods: {
|
|
|
initData() {
|
|
|
+ this.paginationData.currentPage=1;
|
|
|
+ this.paginationData.pageSize = 10;
|
|
|
+ this.paginationData.total = 0;
|
|
|
this.getTableData(1);
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
@@ -79,31 +87,35 @@ export default {
|
|
|
},
|
|
|
getTableData(page) {
|
|
|
this.tableData = [];
|
|
|
- getUserList(this.active, page, this.currentPageSize, this.name).then((res) => {
|
|
|
- if (res.data.code === 0 && res.data.data.length > 0) {
|
|
|
+ getUserList(this.active, page, this.currentPageSize, this.searchVal).then((res) => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
this.paginationData.total = res.data.total;
|
|
|
- this.tableData = res.data.data.map((e) => {
|
|
|
- return {
|
|
|
- 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,
|
|
|
- permission:
|
|
|
- e.permission == "undefined" || !e.permission
|
|
|
- ? e.permission
|
|
|
- : "--",
|
|
|
- working_address:
|
|
|
- e.company == "undefined" || !e.company ? "--" : e.company,
|
|
|
- register_time: this.$dayjs(e.register_time).format(
|
|
|
- "YYYY-MM-DD HH:mm:ss"
|
|
|
- ),
|
|
|
- status:
|
|
|
- e.on_job_status == "undefined" || !e.on_job_status
|
|
|
- ? "--"
|
|
|
- : e.on_job_status,
|
|
|
- };
|
|
|
- });
|
|
|
+ this.paginationData.currentPage = 1;
|
|
|
+ this.paginationData.pageSize = 10
|
|
|
+ if (res.data.data.length > 0) {
|
|
|
+ this.tableData = res.data.data.map((e) => {
|
|
|
+ return {
|
|
|
+ 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,
|
|
|
+ permission:
|
|
|
+ e.permission == "undefined" || !e.permission
|
|
|
+ ? e.permission
|
|
|
+ : "--",
|
|
|
+ working_address:
|
|
|
+ e.company == "undefined" || !e.company ? "--" : e.company,
|
|
|
+ register_time: this.$dayjs(e.register_time).format(
|
|
|
+ "YYYY-MM-DD HH:mm:ss"
|
|
|
+ ),
|
|
|
+ status:
|
|
|
+ e.on_job_status == "undefined" || !e.on_job_status
|
|
|
+ ? "--"
|
|
|
+ : e.on_job_status,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -111,102 +123,85 @@ export default {
|
|
|
this.currentPageSize = val;
|
|
|
this.getTableData(this.currentPage);
|
|
|
},
|
|
|
- userDetail() {
|
|
|
- this.$refs.userDetail.dialogVisible = true;
|
|
|
+ view(data) {
|
|
|
+ this.$emit('view', data);
|
|
|
},
|
|
|
- userInfoEdit() {
|
|
|
- this.$refs.userInfoEdit.dialogVisible = true;
|
|
|
+ edit(data) {
|
|
|
+ this.$emit('edit', data);
|
|
|
},
|
|
|
-
|
|
|
deleteUser(data) {
|
|
|
- let options = {
|
|
|
- id:data.id,
|
|
|
- // username: data.username,
|
|
|
- // password: getUserInfo(data.id).then((res) =>{
|
|
|
- // console.log(res);
|
|
|
- // }),
|
|
|
- };
|
|
|
- console.log(options);
|
|
|
- deleteSingleUser(options).then((res) => {
|
|
|
- if (res.data.code === 0) {
|
|
|
- this.$message.success("删除成功");
|
|
|
- this.getTableData(1);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- userDetail(data) { },
|
|
|
- userInfoEdit(data) {
|
|
|
- let options = {
|
|
|
- id: data.id,
|
|
|
- };
|
|
|
- updateUserDetail(options).then((res) => { });
|
|
|
- },
|
|
|
- batchActivate() { },
|
|
|
- batchDelete() { },
|
|
|
- exportData() { },
|
|
|
+ let app = this;
|
|
|
+ this.$confirm('是否删除用户:'+data.username+' ?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ app.$emit('del', data)
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
|
.el-tag {
|
|
|
- width: 12px;
|
|
|
- height: 12px;
|
|
|
- border-radius: 100px;
|
|
|
- padding: 0;
|
|
|
+ width: 12px;
|
|
|
+ height: 12px;
|
|
|
+ border-radius: 100px;
|
|
|
+ padding: 0;
|
|
|
}
|
|
|
|
|
|
.el-table {
|
|
|
- margin-top: 12px;
|
|
|
- border: 1px solid #f0f2f2;
|
|
|
- font-size: 0.95rem;
|
|
|
- font-family: PingFang SC;
|
|
|
- font-weight: 500;
|
|
|
- color: #b2b2b2;
|
|
|
- background: rgba(255, 255, 255, 0.8);
|
|
|
+ margin-top: 12px;
|
|
|
+ border: 1px solid #f0f2f2;
|
|
|
+ font-size: 0.95rem;
|
|
|
+ font-family: PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #b2b2b2;
|
|
|
+ background: rgba(255, 255, 255, 0.8);
|
|
|
|
|
|
- /deep/th {
|
|
|
- background: #f7fbff;
|
|
|
- }
|
|
|
+ /deep/ th {
|
|
|
+ background: #f7fbff;
|
|
|
+ }
|
|
|
|
|
|
- /deep/.el-checkbox {
|
|
|
- color: #b2b2b2;
|
|
|
+ /deep/ .el-checkbox {
|
|
|
+ color: #b2b2b2;
|
|
|
|
|
|
- .el-checkbox__input.is-checked+.el-checkbox__label {
|
|
|
- color: #2ea8e6;
|
|
|
- }
|
|
|
+ .el-checkbox__input.is-checked + .el-checkbox__label {
|
|
|
+ color: #2ea8e6;
|
|
|
+ }
|
|
|
|
|
|
- .el-checkbox__input.is-checked .el-checkbox__inner::after {
|
|
|
- width: 70%;
|
|
|
- height: 70%;
|
|
|
- background: #2ea8e6;
|
|
|
- border-radius: 0;
|
|
|
- transform: rotate(0deg) scaleY(1);
|
|
|
- position: static;
|
|
|
- // border: 1px solid #8DD9FF;
|
|
|
- }
|
|
|
+ .el-checkbox__input.is-checked .el-checkbox__inner::after {
|
|
|
+ width: 70%;
|
|
|
+ height: 70%;
|
|
|
+ background: #2ea8e6;
|
|
|
+ border-radius: 0;
|
|
|
+ transform: rotate(0deg) scaleY(1);
|
|
|
+ position: static;
|
|
|
+ // border: 1px solid #8DD9FF;
|
|
|
+ }
|
|
|
|
|
|
- .el-checkbox__inner {
|
|
|
- border: 1px solid #8dd9ff;
|
|
|
- background: rgba(0, 170, 255, 0);
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- position: static;
|
|
|
+ .el-checkbox__inner {
|
|
|
+ border: 1px solid #8dd9ff;
|
|
|
+ background: rgba(0, 170, 255, 0);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: static;
|
|
|
|
|
|
- &::after {
|
|
|
- transition: 0ms;
|
|
|
- }
|
|
|
- }
|
|
|
+ &::after {
|
|
|
+ transition: 0ms;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- .el-checkbox__label {
|
|
|
- padding-left: 0;
|
|
|
- font-size: 15px;
|
|
|
- position: absolute;
|
|
|
- top: 1px;
|
|
|
- left: 25px;
|
|
|
- }
|
|
|
+ .el-checkbox__label {
|
|
|
+ padding-left: 0;
|
|
|
+ font-size: 15px;
|
|
|
+ position: absolute;
|
|
|
+ top: 1px;
|
|
|
+ left: 25px;
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
</style>
|