Commit c1ef43c7 authored by 夏敏伟's avatar 夏敏伟

增加导出用户邮箱功能

parent 09eac4c8
......@@ -6,11 +6,11 @@
<div class="new-user" @click="addNew">
<img :src="img3" alt="" />&nbsp;新增
</div>
<div class="button-search" @click="exportUserList">导出邮箱</div>
</div>
<div class="management-content">
<div class="yhlb">
<table>
<!-- <table>
<thead>
<tr>
<td>序号</td>
......@@ -45,7 +45,33 @@
</td>
</tr>
</tbody>
</table>
</table> -->
<el-table class="myTable" ref="multipleTable" :data="data_table" style="width: 100%" stripe
height="100%" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center" :selectable="handleDisable"></el-table-column>
<el-table-column type="index" label="序号" width="80" align="center"></el-table-column>
<el-table-column prop="account" label="登录用户名" align="center"></el-table-column>
<el-table-column prop="username" label="真实姓名" align="center"></el-table-column>
<el-table-column prop="mail" label="邮箱" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="role.name" label="角色" align="center"></el-table-column>
<el-table-column prop="telephone" label="电话号码" align="center"></el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<el-table-column label="状态" align="center">
<template slot-scope="scope">
<el-switch v-model="scope.row.state" @change="change_state(scope.row)" active-color="#13ce66"
inactive-color="#ff4949" active-value="1" inactive-value="0" active-text="启用" inactive-text="停用">>
</el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<i class="el-icon-edit" title="编辑用户信息" @click="edit(scope.row, scope.$index)"></i>&emsp;
<i class="el-icon-delete-solid" title="删除用户信息" @click="remove(scope.row, scope.$index)"></i>&emsp;
<i class="el-icon-refresh-left" title="重置用户密码" @click="resetPassword(scope.row.account)"></i>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-dialog title="提示" :visible.sync="centerDialogVisible" center>
......@@ -151,12 +177,15 @@
line-height: 30px;
float: left;
margin-left: 20px;
font-size: 15px;
text-align: center;
cursor: pointer;
color: white;
background-image: url(../../assets/img/yqjc/40.png);
background-repeat: no-repeat;
background-size: 100% 100%;
// background-image: url(../../assets/img/yqjc/40.png);
// background-repeat: no-repeat;
// background-size: 100% 100%;
border: 1px solid #3a5f94c9 !important;
box-shadow: 0 0 10px #25365f;
}
.new-user {
......@@ -166,10 +195,13 @@
text-align: center;
float: left;
margin-left: 20px;
font-size: 14px;
color: white;
cursor: pointer;
background: url(../../assets/img/yqjc/40.png) no-repeat;
background-size: 100% 100%;
// background: url(../../assets/img/yqjc/40.png) no-repeat;
// background-size: 100% 100%;
border: 1px solid #3a5f94c9 !important;
box-shadow: 0 0 10px #25365f;
}
}
......@@ -187,71 +219,137 @@
padding-top: 40px;
box-sizing: border-box;
table {
width: 100%;
height: calc(100% - 10px);
color: white;
text-align: center;
border-collapse: collapse;
.myTable {
background-color: transparent !important;
tbody {
display: block;
height: calc(100% - 50px);
overflow-y: scroll;
}
thead,
tbody tr {
display: table;
width: 100%;
table-layout: fixed;
.el-table__body tr:hover>td {
background-color: #18213a !important;
}
/*滚动条默认宽度是16px 将thead的宽度减16px*/
table thead {
width: calc(100% - 1em);
&::before {
display: none !important;
}
thead tr {
height: 40px;
thead {
color: white;
background: url(../../assets/img/setting/tr1.png) no-repeat;
background-size: 100% 100%;
}
tbody tr {
border-bottom: 1px solid #252631;
th {
background-color: transparent !important;
}
th.is-leaf {
border-bottom: none !important;
}
tr {
background-color: transparent !important;
}
tbody tr td {
padding: 10px;
td {
color: white;
border-bottom: none !important;
.el-switch__label {
color: white;
}
.el-switch__label.is-active {
color: #409EFF;
}
.el-icon-edit {
font-size: 24px;
font-size: 20px;
color: #409eff;
cursor: pointer;
}
.el-icon-delete-solid {
font-size: 24px;
font-size: 20px;
color: red;
cursor: pointer;
}
.el-icon-refresh-left {
font-size: 24px;
font-size: 20px;
color: #12dc12;
cursor: pointer;
}
}
}
.el-switch__label {
color: white;
}
.el-switch__label.is-active {
color: green;
}
.myTable.el-table--striped .el-table__body tr.el-table__row--striped td {
background-color: #18213a !important;
}
// table {
// width: 100%;
// height: calc(100% - 10px);
// color: white;
// text-align: center;
// border-collapse: collapse;
// tbody {
// display: block;
// height: calc(100% - 50px);
// overflow-y: scroll;
// }
// thead,
// tbody tr {
// display: table;
// width: 100%;
// table-layout: fixed;
// }
// /*滚动条默认宽度是16px 将thead的宽度减16px*/
// table thead {
// width: calc(100% - 1em);
// }
// thead tr {
// height: 40px;
// background: url(../../assets/img/setting/tr1.png) no-repeat;
// background-size: 100% 100%;
// }
// tbody tr {
// border-bottom: 1px solid #252631;
// }
// tbody tr td {
// padding: 10px;
// .el-icon-edit {
// font-size: 24px;
// color: #409eff;
// cursor: pointer;
// }
// .el-icon-delete-solid {
// font-size: 24px;
// color: red;
// cursor: pointer;
// }
// .el-icon-refresh-left {
// font-size: 24px;
// color: #12dc12;
// cursor: pointer;
// }
// }
// .el-switch__label {
// color: white;
// }
// .el-switch__label.is-active {
// color: green;
// }
// }
}
}
......@@ -328,10 +426,12 @@ import {
startLoading,
endLoading,
} from "../../util/http_util";
import XLSX from "xlsx";
export default {
name: "yhgl",
data() {
return {
multipleSelection: [],
rules: {
account: [
{ required: true, message: '请输入账号', trigger: 'blur' },
......@@ -429,6 +529,45 @@ export default {
};
},
methods: {
handleDisable(row) {
if (row.mail) {
return true;
} else {
return false;
}
},
exportUserList() {
if (this.multipleSelection.length > 0) {
const body = this.multipleSelection.filter(item => item.mail).map(item => (['', '', '', '', item.account, item.username, '', '', '',
'', item.mail, '', '', '', '', '', '', item.telephone,
item.mail, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']));
const header = [['Title', 'First Name', 'Middle Name', 'Last Name', 'Nick Name', 'Display Name', 'Company', 'Department', 'Job Title',
'Office Location', 'E-mail Address', 'Notes', 'Web Page', 'Birthday', 'Other Email', 'Other Phone', 'Other Mobile', 'Mobile Phone',
'Home Email', 'Home Phone', 'Home Fax', 'Home Street', 'Home City', 'Home State', 'Home Postal Code', 'Home Country',
'Business Email', 'Business Phone', 'Business Fax', 'Business Street', 'Business City', 'Business State', 'Business Postal Code', 'Business Country']];
body.unshift(...header);
const workbook = XLSX.utils.book_new();
const sheet = XLSX.utils.aoa_to_sheet(body);
XLSX.utils.book_append_sheet(workbook, sheet, 'contacts'); // 向 workbook 中添加 sheet
XLSX.writeFile(workbook, 'contacts.csv'); // 导出 workbook
} else {
this.$message.warning('请选择要导出的用户!');
}
},
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
handleSelectionChange(val) {
// debugger
this.multipleSelection = val;
},
queryUser() {
get("api/rest/system/user/queryUser").then((data) => {
this.data_table = data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment