|
@@ -84,10 +84,13 @@
|
|
|
<div class="newUserManagement-content-right-bottom">
|
|
|
<div class="head flex">
|
|
|
<div class="title">账号列表</div>
|
|
|
- <el-button @click="handleTableAdd" type="primary" size="small" :disabled="addUserDisabled">新增</el-button>
|
|
|
+ <div>
|
|
|
+ <el-button @click="handleTableAdd" type="primary" size="small" :disabled="addUserDisabled">新增</el-button>
|
|
|
+ <el-button @click="exportHandler('userTableData')" type="primary" size="small" :disabled="addUserDisabled">导出</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div class="contents">
|
|
|
- <el-table :data="tableData" height="100%" border style="width: 100%">
|
|
|
+ <el-table :data="tableData" height="100%" border style="width: 100%" ref="userTableData">
|
|
|
<el-table-column prop="user_name" label="用户名">
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="user_status" label="状态">
|
|
@@ -105,6 +108,8 @@
|
|
|
<div v-if="scope.row.LogoutTime">{{ scope.row.LogoutTime.replace('T',' ') }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column prop="email" label="邮箱">
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="user_comment" label="描述">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="235">
|
|
@@ -161,6 +166,9 @@
|
|
|
<el-form-item label="二级密码" prop="user_sec_pwd">
|
|
|
<el-input v-model="ruleForm.user_sec_pwd" size="small" placeholder="请输入二级密码" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="邮箱" prop="email">
|
|
|
+ <el-input v-model="ruleForm.email" size="small" placeholder="请输入邮箱" />
|
|
|
+ </el-form-item>
|
|
|
<!-- <el-form-item label="令牌有限期" prop="token_valid_duration">
|
|
|
<el-input v-model="ruleForm.token_valid_duration" size="small" placeholder="请输入令牌有限期(小时)" />
|
|
|
</el-form-item> -->
|
|
@@ -217,6 +225,9 @@ import Dialog from '@/layout/components/Dialog'
|
|
|
import pf from '@/layout/mixin/publicFunc'
|
|
|
import MD5 from 'blueimp-md5'
|
|
|
import { listToTree } from '@/utils/validate'
|
|
|
+import XLSX from "xlsx";
|
|
|
+import { Format } from '@/utils/validate'
|
|
|
+import { exportToExcel } from '@/utils/table'
|
|
|
export default {
|
|
|
name: 'NewManageMent',
|
|
|
components: { Dialog },
|
|
@@ -257,12 +268,14 @@ export default {
|
|
|
"user_pwd": null,
|
|
|
"user_sec_pwd": null,
|
|
|
"user_status": null,
|
|
|
- "user_token": null
|
|
|
+ "user_token": null,
|
|
|
+ "email":null
|
|
|
},
|
|
|
tableRules: {
|
|
|
user_name: [{ required: true, message: "请输入账号名称", trigger: "blur" }],
|
|
|
user_group_id: [{ required: true, message: '请选择账号组', trigger: 'change' }],
|
|
|
user_pwd: [{ required: true, message: "请输入密码", trigger: "blur" }],
|
|
|
+ email: [{ required: true, pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, message: '请输入正确的邮箱格式', trigger: 'blur' }],
|
|
|
},
|
|
|
paswordFlag: false,//修改密码
|
|
|
tableFlag: false,
|
|
@@ -292,7 +305,8 @@ export default {
|
|
|
label: 'user_group_name'
|
|
|
},
|
|
|
arrTree: [],
|
|
|
- treeCheckObj: {}
|
|
|
+ treeCheckObj: {},
|
|
|
+ groupname:''
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -344,6 +358,7 @@ export default {
|
|
|
// this.treeCheckId = this.arrs[this.arrs.length-1].user_group_id
|
|
|
},
|
|
|
async handleNodeClick (data) {
|
|
|
+ this.groupname = data.user_group_name
|
|
|
if (data.user_group_id) {
|
|
|
const datas = this.arrTree.filter(item => item.user_group_id == data.up_user_group_id)
|
|
|
this.treeCheckId = data.user_group_id
|
|
@@ -623,7 +638,39 @@ export default {
|
|
|
this.paswordFlag = false
|
|
|
this.tableFlag = false
|
|
|
this.clearTableForm()
|
|
|
- }
|
|
|
+ },
|
|
|
+ //导出
|
|
|
+ downFile() {
|
|
|
+ var wb = XLSX.utils.table_to_book(
|
|
|
+ document.querySelector("#userTableData")
|
|
|
+ );
|
|
|
+ var wbout = XLSX.write(wb, {
|
|
|
+ bookType: "xlsx",
|
|
|
+ bookSST: true,
|
|
|
+ type: "array",
|
|
|
+ });
|
|
|
+ try {
|
|
|
+ FileSaver.saveAs(
|
|
|
+ new Blob([wbout], {
|
|
|
+ type: "application/octet-stream",
|
|
|
+ }),
|
|
|
+ this.groupname + Format('yyyy-MM-dd', new Date()), + ".xlsx"
|
|
|
+ );
|
|
|
+ } catch (e) {
|
|
|
+ if (typeof console !== "undefined") console.log(e, wbout);
|
|
|
+ }
|
|
|
+ return wbout;
|
|
|
+ },
|
|
|
+ exportHandler: _.throttle(
|
|
|
+ function (refName) {
|
|
|
+ const table = this.$refs[refName].$el.cloneNode(true)
|
|
|
+ const fileName = `${ this.groupname + Format('yyyy-MM-dd', new Date())}.xlsx`
|
|
|
+ console.log(fileName)
|
|
|
+ exportToExcel(table, this.groupname, fileName)
|
|
|
+ },
|
|
|
+ 2000,
|
|
|
+ { trailing: false }
|
|
|
+ ),
|
|
|
}
|
|
|
}
|
|
|
</script>
|