From feb9c54e2f637244ff75c3ba5e74e7bc79093a3f Mon Sep 17 00:00:00 2001 From: anhc <3442943606@qq.com> Date: Thu, 7 Jul 2022 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=E5=B0=8F=E7=BB=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/member/MemberAdd.vue | 131 +++++++++++++++++- 1 file changed, 126 insertions(+), 5 deletions(-) diff --git a/com.actionsoft.apps.coe.pal.cooperation/src/views/member/MemberAdd.vue b/com.actionsoft.apps.coe.pal.cooperation/src/views/member/MemberAdd.vue index a9dbc00..fb186d1 100644 --- a/com.actionsoft.apps.coe.pal.cooperation/src/views/member/MemberAdd.vue +++ b/com.actionsoft.apps.coe.pal.cooperation/src/views/member/MemberAdd.vue @@ -12,12 +12,38 @@ :before-close="handleClose">
- +
-
+
+
+
+
+
+ + + + {{node.label}} + + +
+
+
+
@@ -79,7 +105,18 @@ roleUpdate: { visible: false, roleId: '', - } + }, + isOlderVersion: true, + userLoading: false, + treeProps: { + label: 'name', + isLeaf: 'leaf' + }, + multiple:true, + addressType: 'user', + highSecurityFilter: 'sysAdmin,auditor' ,// 例如值为sysAdmin,auditor,则开启三员之后该地址簿不显示系统管理员和安全审计员 + pid: '', + } }, methods: { @@ -99,6 +136,7 @@ const data = ro.data; that.form.roleOpts = data.roleOpts; that.form.userOpts = data.userOpts; + that.isOlderVersion = data.isOlderVersion; } else { that.$message.error(ro.msg); } @@ -115,6 +153,9 @@ that.form.roleId = ''; that.form.roleOpts = []; that.buttonDisabled = false; + if (!that.isOlderVersion){ + this.$refs.tree.setCheckedNodes([]); + } }, handleClose(done) { this.closeDlalog('cancel'); @@ -129,6 +170,12 @@ closeDlalog(type) {// 取消/确定之后的关闭 const that = this; if (type == 'save') { + if (!that.isOlderVersion){ + let nodes = this.$refs.tree.getCheckedNodes(); + nodes.forEach((item)=>{ + that.form.userArr.push(item.id); + }) + } if (that.form.userArr.length == 0) { that.$message.error('请选择[成员]'); return; @@ -168,8 +215,11 @@ message: ro.msg, type: 'warning' }); + that.$emit('cancel'); + that.dialogVisible = false; + // 清空所有数据 + that.clearAllData(); } - }).catch(error=>{ console.log(error); that.loading = false; @@ -191,7 +241,78 @@ if (result == 'ok') { this.initData(); } - } + }, + openNode(obj, node, tree) {// 打开一只模型文件 + + }, + expandNode(obj, node, tree) {// 展开节点 + + }, + closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载 + node.childNodes = []; + node.loaded = false; + }, + loadNode(node, resolve) {// `动态`加载 + const that = this; + that.userLoading = true; + const data = { + url:'jd', + data:{ + cmd: 'com.actionsoft.apps.coe.pal_bpm_org_address_component_subjson', + addressType: that.addressType, + pid: '', + highSecurityFilter: that.highSecurityFilter + } + }; + if (node.level === 0) { + // 获取根目录 + data.data.pid = that.pid; + data.data.parentType = ''; + } else { + // 获取其他目录 + data.data.pid = node.data.id; + data.data.parentType = node.data.type; + } + // 查询数据 + awsuiAxios.post(data).then(function (ro) { + // 设置是否可选中 + if (that.multiple) {// 多选 + const isDept = that.addressType.indexOf('department') > -1; + const isUser = that.addressType.indexOf('user') > -1; + const isRole = that.addressType.indexOf('role') > -1; + const isPosition = that.addressType.indexOf('position') > -1; + for (let i = 0; i < ro.data.length; i++) { + const curr = ro.data[i]; + if (curr.type == 'company' || curr.type == 'roleRoot' || curr.type == 'roleGroup' || curr.type == 'positionRoot' || curr.type == 'positionGroup') { + curr.disabled = true; + } else { + if (isDept && curr.type == 'department') curr.disabled = false; + if (!isDept && curr.type == 'department') curr.disabled = true; + if (isUser && curr.type == 'user') curr.disabled = false; + if (!isUser && curr.type == 'user') curr.disabled = true; + if (isRole && curr.type == 'role') curr.disabled = false; + if (!isRole && curr.type == 'role') curr.disabled = true; + if (isPosition && curr.type == 'position') curr.disabled = false; + if (!isPosition && curr.type == 'position') curr.disabled = true; + } + } + } + resolve(ro.data); + that.userLoading = false; + if (node.level == 0 && ro.data.length > 0) { + const tree = that.$refs.tree; + tree.getNode(ro.data[0].id).expand(); + setTimeout(function(){ + const childNode = tree.getNode(ro.data[0].id).childNodes[0]; + if (childNode != null) { + childNode.expand(); + } + }, 500); + } + }).catch(error=>{ + console.log(error); + }) + }, }, watch: { visible(val) {