diff --git a/src/api/system/user.js b/src/api/system/user.js index 3c72131..14e597d 100644 --- a/src/api/system/user.js +++ b/src/api/system/user.js @@ -39,6 +39,18 @@ export const update = (row) => { }) } +export const updatePlatform = (userId, userType, userExt) => { + return request({ + url: '/api/blade-user/update-platform', + method: 'post', + params: { + userId, + userType, + userExt, + } + }) +} + export const getUser = (id) => { return request({ url: '/api/blade-user/detail', @@ -49,6 +61,16 @@ export const getUser = (id) => { }) } +export const getUserPlatform = (id) => { + return request({ + url: '/api/blade-user/platform-detail', + method: 'get', + params: { + id, + } + }) +} + export const getUserInfo = () => { return request({ url: '/api/blade-user/info', diff --git a/src/views/system/user.vue b/src/views/system/user.vue index acdde57..0e50af3 100644 --- a/src/views/system/user.vue +++ b/src/views/system/user.vue @@ -45,12 +45,20 @@ icon="el-icon-user" @click="handleGrant">角色配置 - 密码重置 + 平台配置 + + + + + + + @@ -125,8 +162,10 @@ import { getList, getUser, + getUserPlatform, remove, update, + updatePlatform, add, grant, resetPassword @@ -161,15 +200,22 @@ 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: [], @@ -484,6 +530,77 @@ ] }, 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, @@ -561,6 +678,14 @@ 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 => { @@ -732,6 +857,9 @@ this.roleBox = true; }); }, + handlePlatform() { + this.platformBox = true; + }, handleImport() { this.excelBox = true; }, @@ -789,6 +917,63 @@ this.loading = false; 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(); + }); } } };