|
@@ -24,7 +24,7 @@
|
|
|
<div class="manageTitle">权限树</div>
|
|
|
<div class="t30 auth-tree">
|
|
|
<el-scrollbar>
|
|
|
- <el-tree ref="treeRef" highlight-current @check="currentChange" :default-expanded-keys="checkKeys" :data="data" show-checkbox :props="defaultProps" node-key="auth_id" @node-click="handleNodeClick">
|
|
|
+ <el-tree ref="treeRef" highlight-current @check="currentChange" :default-expanded-keys="checkKeys" :data="data" show-checkbox :props="defaultProps" :expand-on-click-node="false" node-key="auth_id" @node-click="handleNodeClick">
|
|
|
<template #default="{data}">
|
|
|
<span class="custom-tree-node">
|
|
|
{{ data.auth_name }}
|
|
@@ -222,17 +222,15 @@ const roleAuths = async () => {
|
|
|
} catch (error) {}
|
|
|
};
|
|
|
|
|
|
-const handleNodeClick = (data) => {
|
|
|
- checkObj.value = data;
|
|
|
- checkData.value.push(_.cloneDeep(data));
|
|
|
- const datas = _.unionBy(checkData.value, "auth_id");
|
|
|
- checkData.value = datas;
|
|
|
- const checkNode = checkData.value.filter(
|
|
|
- (item) => item.auth_id == data.auth_id
|
|
|
+const handleNodeClick = data => {
|
|
|
+ const cloneData = _.cloneDeep(data)
|
|
|
+ checkObj.value = cloneData;
|
|
|
+ checkData.value = _.unionBy([...checkData.value, cloneData], 'auth_id');
|
|
|
+ const checkNode = boxData.value[boxData.value.length - 1].find(
|
|
|
+ item => item.auth_id == data.auth_id
|
|
|
);
|
|
|
- if (checkNode.length) {
|
|
|
- const formObj = checkNode[0];
|
|
|
- form.value = formObj;
|
|
|
+ if (checkNode) {
|
|
|
+ form.value = { ...checkNode };
|
|
|
} else {
|
|
|
clearFormData();
|
|
|
}
|