|
|
|
|
@ -16,6 +16,33 @@ |
|
|
|
|
:before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset" |
|
|
|
|
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
|
|
|
|
@refresh-change="refreshChange" @on-load="onLoad"> |
|
|
|
|
|
|
|
|
|
<template slot="menuLeft"> |
|
|
|
|
<el-button type="danger" |
|
|
|
|
size="small" |
|
|
|
|
plain |
|
|
|
|
icon="el-icon-delete" |
|
|
|
|
v-if="permission.user_delete" |
|
|
|
|
@click="handleDelete">删 除 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="info" |
|
|
|
|
size="small" |
|
|
|
|
plain |
|
|
|
|
v-if="permission.user_reset" |
|
|
|
|
icon="el-icon-refresh" |
|
|
|
|
@click="handleReset">密码重置 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="info" |
|
|
|
|
size="small" |
|
|
|
|
plain |
|
|
|
|
v-if="userInfo.role_name.includes('admin')" |
|
|
|
|
icon="el-icon-coordinate" |
|
|
|
|
@click="handleLock">账号解封 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{row}" slot="status"> |
|
|
|
|
<el-tag size="small" :type="row.status == 1 ? '' : 'danger'">{{ row.status == 1 ? '启用' : '禁用' }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="scope" slot="menu"> |
|
|
|
|
<el-button type="text" icon="el-icon-circle-plus-outline" size="small" |
|
|
|
|
@click.stop="handleUpdate(scope.row, scope.index)" v-if="userInfo.role_name.includes('admin')">封禁 |
|
|
|
|
@ -36,30 +63,6 @@ |
|
|
|
|
<el-button type="primary" @click="submitRole">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-dialog title="用户数据导入" append-to-body :visible.sync="excelBox" width="555px"> |
|
|
|
|
<avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"> |
|
|
|
|
<template slot="excelTemplate"> |
|
|
|
|
<el-button type="primary" @click="handleTemplate"> |
|
|
|
|
点击下载<i class="el-icon-download el-icon--right"></i> |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
</avue-form> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-dialog title="用户平台配置" append-to-body :visible.sync="platformBox"> |
|
|
|
|
<avue-crud :option="platformOption" :table-loading="platformLoading" :data="platformData" ref="platformCrud" |
|
|
|
|
v-model="platformForm" :before-open="platformBeforeOpen" :page.sync="platformPage" |
|
|
|
|
:permission="platformPermissionList" @row-update="platformRowUpdate" @search-change="platformSearchChange" |
|
|
|
|
@search-reset="platformSearchReset" @selection-change="platformSelectionChange" |
|
|
|
|
@current-change="platformCurrentChange" @size-change="platformSizeChange" |
|
|
|
|
@refresh-change="platformRefreshChange" @on-load="platformOnLoad"> |
|
|
|
|
<template slot-scope="{row}" slot="tenantName"> |
|
|
|
|
<el-tag>{{ row.tenantName }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{row}" slot="userTypeName"> |
|
|
|
|
<el-tag>{{ row.userTypeName }}</el-tag> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 打印 --> |
|
|
|
|
<van-button v-print="printObj">打印测试</van-button> |
|
|
|
|
<div id="pintHtml" class="prin_table" |
|
|
|
|
@ -281,10 +284,8 @@ |
|
|
|
|
import { |
|
|
|
|
getList, |
|
|
|
|
getUser, |
|
|
|
|
getUserPlatform, |
|
|
|
|
remove, |
|
|
|
|
update, |
|
|
|
|
updatePlatform, |
|
|
|
|
add, |
|
|
|
|
grant, |
|
|
|
|
resetPassword, unlock |
|
|
|
|
@ -292,11 +293,9 @@ import { |
|
|
|
|
import { exportBlob } from "@/api/common"; |
|
|
|
|
import { getDeptTree, getDeptLazyTree } from "@/api/system/dept"; |
|
|
|
|
import { getRoleTree } from "@/api/system/role"; |
|
|
|
|
import { getPostList } from "@/api/system/post"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
import website from '@/config/website'; |
|
|
|
|
import { getToken } from '@/util/auth'; |
|
|
|
|
import { downloadXls } from "@/util/util"; |
|
|
|
|
import { dateNow } from "@/util/date"; |
|
|
|
|
import NProgress from 'nprogress'; |
|
|
|
|
import 'nprogress/nprogress.css'; |
|
|
|
|
@ -327,24 +326,15 @@ export default { |
|
|
|
|
}, |
|
|
|
|
form: {}, |
|
|
|
|
search: {}, |
|
|
|
|
roleBox: false, |
|
|
|
|
excelBox: false, |
|
|
|
|
platformBox: false, |
|
|
|
|
initFlag: true, |
|
|
|
|
selectionList: [], |
|
|
|
|
query: {}, |
|
|
|
|
loading: true, |
|
|
|
|
platformLoading: false, |
|
|
|
|
page: { |
|
|
|
|
pageSize: 10, |
|
|
|
|
currentPage: 1, |
|
|
|
|
total: 0 |
|
|
|
|
}, |
|
|
|
|
platformPage: { |
|
|
|
|
pageSize: 10, |
|
|
|
|
currentPage: 1, |
|
|
|
|
total: 0 |
|
|
|
|
}, |
|
|
|
|
init: { |
|
|
|
|
roleTree: [], |
|
|
|
|
deptTree: [], |
|
|
|
|
@ -353,8 +343,6 @@ export default { |
|
|
|
|
label: "title", |
|
|
|
|
value: "key" |
|
|
|
|
}, |
|
|
|
|
roleGrantList: [], |
|
|
|
|
roleTreeObj: [], |
|
|
|
|
treeDeptId: '', |
|
|
|
|
treeData: [], |
|
|
|
|
treeOption: { |
|
|
|
|
@ -682,129 +670,6 @@ export default { |
|
|
|
|
// ] |
|
|
|
|
}, |
|
|
|
|
data: [], |
|
|
|
|
platformQuery: {}, |
|
|
|
|
platformSelectionList: [], |
|
|
|
|
platformData: [], |
|
|
|
|
platformForm: {}, |
|
|
|
|
platformOption: { |
|
|
|
|
tip: false, |
|
|
|
|
searchShow: true, |
|
|
|
|
searchMenuSpan: 6, |
|
|
|
|
border: true, |
|
|
|
|
index: true, |
|
|
|
|
selection: true, |
|
|
|
|
viewBtn: true, |
|
|
|
|
dialogClickModal: false, |
|
|
|
|
menuWidth: 120, |
|
|
|
|
editBtnText: '配置', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "登录账号", |
|
|
|
|
prop: "account", |
|
|
|
|
search: true, |
|
|
|
|
display: false |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// label: "所属租户", |
|
|
|
|
// prop: "tenantName", |
|
|
|
|
// slot: true, |
|
|
|
|
// display: false |
|
|
|
|
// }, |
|
|
|
|
{ |
|
|
|
|
label: "用户姓名", |
|
|
|
|
prop: "realName", |
|
|
|
|
search: true, |
|
|
|
|
display: false |
|
|
|
|
}, |
|
|
|
|
// { |
|
|
|
|
// label: "用户平台", |
|
|
|
|
// prop: "userTypeName", |
|
|
|
|
// slot: true, |
|
|
|
|
// display: false |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// label: "用户平台", |
|
|
|
|
// type: "select", |
|
|
|
|
// dicUrl: "/api/blade-system/dict/dictionary?code=user_type", |
|
|
|
|
// props: { |
|
|
|
|
// label: "dictValue", |
|
|
|
|
// value: "dictKey" |
|
|
|
|
// }, |
|
|
|
|
// dataType: "number", |
|
|
|
|
// search: true, |
|
|
|
|
// hide: true, |
|
|
|
|
// display: false, |
|
|
|
|
// prop: "userType", |
|
|
|
|
// rules: [{ |
|
|
|
|
// required: true, |
|
|
|
|
// message: "请选择用户平台", |
|
|
|
|
// trigger: "blur" |
|
|
|
|
// }] |
|
|
|
|
// }, |
|
|
|
|
// { |
|
|
|
|
// label: "用户拓展", |
|
|
|
|
// prop: "userExt", |
|
|
|
|
// type: "textarea", |
|
|
|
|
// minRows: 8, |
|
|
|
|
// span: 24, |
|
|
|
|
// overHidden: true, |
|
|
|
|
// row: true, |
|
|
|
|
// hide: true, |
|
|
|
|
// }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
excelForm: {}, |
|
|
|
|
excelOption: { |
|
|
|
|
submitBtn: false, |
|
|
|
|
emptyBtn: false, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: '模板上传', |
|
|
|
|
prop: 'excelFile', |
|
|
|
|
type: 'upload', |
|
|
|
|
drag: true, |
|
|
|
|
loadText: '模板上传中,请稍等', |
|
|
|
|
span: 24, |
|
|
|
|
propsHttp: { |
|
|
|
|
res: 'data' |
|
|
|
|
}, |
|
|
|
|
tip: '请上传 .xls,.xlsx 标准格式文件', |
|
|
|
|
action: "/api/blade-user/import-user" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "数据覆盖", |
|
|
|
|
prop: "isCovered", |
|
|
|
|
type: "switch", |
|
|
|
|
align: "center", |
|
|
|
|
width: 80, |
|
|
|
|
dicData: [ |
|
|
|
|
{ |
|
|
|
|
label: "否", |
|
|
|
|
value: 0 |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "是", |
|
|
|
|
value: 1 |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
value: 0, |
|
|
|
|
slot: true, |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
required: true, |
|
|
|
|
message: "请选择是否覆盖", |
|
|
|
|
trigger: "blur" |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '模板下载', |
|
|
|
|
prop: 'excelTemplate', |
|
|
|
|
formslot: true, |
|
|
|
|
span: 24, |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
sex: '' |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
@ -814,12 +679,6 @@ export default { |
|
|
|
|
this.initData(this.form.tenantId); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
'excelForm.isCovered'() { |
|
|
|
|
if (this.excelForm.isCovered !== '') { |
|
|
|
|
const column = this.findObject(this.excelOption.column, "excelFile"); |
|
|
|
|
column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
directives: { |
|
|
|
|
print |
|
|
|
|
@ -834,14 +693,6 @@ export default { |
|
|
|
|
editBtn: this.vaildData(this.permission.user_edit, false) |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
platformPermissionList() { |
|
|
|
|
return { |
|
|
|
|
addBtn: false, |
|
|
|
|
viewBtn: false, |
|
|
|
|
delBtn: false, |
|
|
|
|
editBtn: this.vaildData(this.permission.user_edit, false) |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
ids() { |
|
|
|
|
let ids = []; |
|
|
|
|
this.selectionList.forEach(ele => { |
|
|
|
|
@ -873,10 +724,6 @@ export default { |
|
|
|
|
const column = this.findObject(this.option.column, "deptId"); |
|
|
|
|
column.dicData = res.data.data; |
|
|
|
|
}); |
|
|
|
|
getPostList(tenantId).then(res => { |
|
|
|
|
const column = this.findObject(this.option.group, "postId"); |
|
|
|
|
column.dicData = res.data.data; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
submitRole() { |
|
|
|
|
const roleList = this.$refs.treeRole.getCheckedKeys().join(","); |
|
|
|
|
@ -1015,9 +862,6 @@ export default { |
|
|
|
|
this.roleBox = true; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handlePlatform() { |
|
|
|
|
this.platformBox = true; |
|
|
|
|
}, |
|
|
|
|
handleLock() { |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.warning("请选择至少一条数据"); |
|
|
|
|
@ -1038,35 +882,6 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleImport() { |
|
|
|
|
this.excelBox = true; |
|
|
|
|
}, |
|
|
|
|
uploadAfter(res, done, loading, column) { |
|
|
|
|
window.console.log(column); |
|
|
|
|
this.excelBox = false; |
|
|
|
|
this.refreshChange(); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
handleExport() { |
|
|
|
|
const account = func.toStr(this.search.account); |
|
|
|
|
const realName = func.toStr(this.search.realName); |
|
|
|
|
this.$confirm("是否导出用户数据?", "提示", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
NProgress.start(); |
|
|
|
|
exportBlob(`/api/blade-user/export-user?${this.website.tokenHeader}=${getToken()}&account=${account}&realName=${realName}`).then(res => { |
|
|
|
|
downloadXls(res.data, `用户数据表${dateNow()}.xlsx`); |
|
|
|
|
NProgress.done(); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleTemplate() { |
|
|
|
|
exportBlob(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => { |
|
|
|
|
downloadXls(res.data, "用户数据模板.xlsx"); |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
beforeOpen(done, type) { |
|
|
|
|
if (["edit", "view"].includes(type)) { |
|
|
|
|
getUser(this.form.id).then(res => { |
|
|
|
|
@ -1104,63 +919,6 @@ export default { |
|
|
|
|
this.selectionClear(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
platformRowUpdate(row, index, done, loading) { |
|
|
|
|
updatePlatform(row.id, row.userType, row.userExt).then(() => { |
|
|
|
|
this.platformOnLoad(this.platformPage); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
done(); |
|
|
|
|
}, error => { |
|
|
|
|
window.console.log(error); |
|
|
|
|
loading(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
platformBeforeOpen(done, type) { |
|
|
|
|
if (["edit", "view"].includes(type)) { |
|
|
|
|
getUserPlatform(this.platformForm.id).then(res => { |
|
|
|
|
this.platformForm = res.data.data; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
platformSearchReset() { |
|
|
|
|
this.platformQuery = {}; |
|
|
|
|
this.platformOnLoad(this.platformPage); |
|
|
|
|
}, |
|
|
|
|
platformSearchChange(params, done) { |
|
|
|
|
this.platformQuery = params; |
|
|
|
|
this.platformPage.currentPage = 1; |
|
|
|
|
this.platformOnLoad(this.platformPage, params); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
platformSelectionChange(list) { |
|
|
|
|
this.platformSelectionList = list; |
|
|
|
|
}, |
|
|
|
|
platformSelectionClear() { |
|
|
|
|
this.platformSelectionList = []; |
|
|
|
|
this.$refs.platformCrud.toggleSelection(); |
|
|
|
|
}, |
|
|
|
|
platformCurrentChange(currentPage) { |
|
|
|
|
this.platformPage.currentPage = currentPage; |
|
|
|
|
}, |
|
|
|
|
platformSizeChange(pageSize) { |
|
|
|
|
this.platformPage.pageSize = pageSize; |
|
|
|
|
}, |
|
|
|
|
platformRefreshChange() { |
|
|
|
|
this.platformOnLoad(this.platformPage, this.platformQuery); |
|
|
|
|
}, |
|
|
|
|
platformOnLoad(page, params = {}) { |
|
|
|
|
this.platformLoading = true; |
|
|
|
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => { |
|
|
|
|
const data = res.data.data; |
|
|
|
|
this.platformPage.total = data.total; |
|
|
|
|
this.platformData = data.records; |
|
|
|
|
this.platformLoading = false; |
|
|
|
|
this.selectionClear(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|