diff --git a/ebts-ui/.env.staging b/ebts-ui/.env.staging index f77131a..4280611 100644 --- a/ebts-ui/.env.staging +++ b/ebts-ui/.env.staging @@ -5,5 +5,4 @@ ENV = 'staging' # EBTS/测试环境 #VUE_APP_BASE_API = '/dev-api' -#VUE_APP_BASE_API = 'https://api.ebts.top/dev-api' -VUE_APP_BASE_API = 'http://tapi.ebts.top/dev-api' +VUE_APP_BASE_API = 'http://sistapi.hchyun.cn/dev-api' diff --git a/ebts-ui/src/views/system/dept/index.vue b/ebts-ui/src/views/system/dept/index.vue index e2b6698..d8ad050 100644 --- a/ebts-ui/src/views/system/dept/index.vue +++ b/ebts-ui/src/views/system/dept/index.vue @@ -134,8 +134,7 @@ - - + 全选/全不选 父子联动 diff --git a/ebts-ui/src/views/system/user/index.vue b/ebts-ui/src/views/system/user/index.vue index 83ea13e..8630067 100644 --- a/ebts-ui/src/views/system/user/index.vue +++ b/ebts-ui/src/views/system/user/index.vue @@ -295,6 +295,25 @@ + + + + 全选/全不选 + 父子联动 + + + + + @@ -364,6 +383,9 @@ export default { multiple: true, // 显示搜索条件 showSearch: true, + siteTypeExpand: false, + siteTypeNodeAll: false, + siteTypeCheckStrictly:false, // 总条数 total: 0, // 用户表格数据 @@ -388,6 +410,11 @@ export default { postOptions: [], // 角色选项 roleOptions: [], + siteTypeOptions: [], + defaultsiteType: { + children: "children", + label: "dictLabel", + }, // 表单参数 form: {}, defaultProps: { @@ -487,6 +514,7 @@ export default { this.deptOptions = response.data; }); }, + // 筛选节点 filterNode(value, data) { if (!value) return true; @@ -512,13 +540,61 @@ export default { row.status = row.status === "0" ? "1" : "0"; }); }, + + getSiteTypeTree() { + this.getDicts('article_type').then(res => { + let sist = { + attribute2: 1, + dictCode: 0, + dictLabel: "信息网站", + children: [], + } + let lab = { + attribute2: 2, + dictCode: 1, + dictLabel: "lab实验室", + children: [], + } + let data = res.data + for (let i = 0; i < data.length; i++) { + if (data[i].attribute2 === 1) { + sist.children.push(data[i]) + } else { + lab.children.push(data[i]) + } + } + this.siteTypeOptions.push(sist) + this.siteTypeOptions.push(lab) + }) + }, + + // 树权限(展开/折叠) + handleCheckedTreeExpand(value) { + let treeList = this.siteTypeOptions; + for (let i = 0; i < treeList.length; i++) { + this.$refs.siteType.store.nodesMap[treeList[i].id].expanded = value; + } + }, + // 树权限(全选/全不选) + handleCheckedTreeNodeAll(value) { + this.$refs.siteType.setCheckedNodes(value ? this.siteTypeOptions : []); + }, + // 树权限(父子联动) + handleCheckedTreeConnect(value,) { + this.siteTypeCheckStrictly = value ? true : false; + }, // 取消按钮 cancel() { this.open = false; + this.siteTypeExpand = false; + this.siteTypeNodeAll = false; this.reset(); }, // 表单重置 reset() { + this.siteTypeNodeAll = false; + this.siteTypeOptions = []; + this.siteTypeCheckStrictly = true; this.form = { userId: undefined, deptId: undefined, @@ -556,6 +632,7 @@ export default { handleAdd() { this.reset(); this.getTreeselect(); + this.getSiteTypeTree(); getUser().then(response => { this.postOptions = response.posts; this.roleOptions = response.roles; @@ -568,6 +645,7 @@ export default { handleUpdate(row) { this.reset(); this.getTreeselect(); + this.getSiteTypeTree(); const userId = row.userId || this.ids; getUser(userId).then(response => { this.form = response.data; @@ -578,6 +656,9 @@ export default { this.open = true; this.title = "修改用户"; this.form.password = ""; + this.$nextTick(() => { + this.$refs.siteType.setCheckedKeys(this.form.siteTypes); + }); }); }, /** 重置密码按钮操作 */ @@ -591,8 +672,18 @@ export default { }); }).catch(() => {}); }, + // 所有菜单节点数据 + getSiteTypeAllCheckedKeys() { + // 目前被选中的菜单节点 + let checkedKeys = this.$refs.siteType.getCheckedKeys(); + // 半选中的菜单节点 + let halfCheckedKeys = this.$refs.siteType.getHalfCheckedKeys(); + checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); + return checkedKeys; + }, /** 提交按钮 */ submitForm: function() { + this.form.siteTypes = this.getSiteTypeAllCheckedKeys() this.$refs["form"].validate(valid => { if (valid) { if (this.form.userId != undefined) {