|
|
@@ -16,6 +16,7 @@
|
|
|
<template #default="{ node, data }">
|
|
|
<span
|
|
|
class="custom-tree-node"
|
|
|
+ :class="{ alive: data.id == collectDir }"
|
|
|
@click="checkoutNode(node, data)"
|
|
|
@click.right="rightFn(node, data, $event)"
|
|
|
>
|
|
|
@@ -73,6 +74,7 @@ const curArr = ref([]); //默认展开一级目录
|
|
|
const folderTreeRef = ref();
|
|
|
const curNode = ref();
|
|
|
const topId = ref(); //顶层的id
|
|
|
+const collectDir = ref();
|
|
|
const defaultProps = ref({
|
|
|
label: "label",
|
|
|
value: "id",
|
|
|
@@ -104,6 +106,7 @@ function getFileTree() {
|
|
|
const checkoutNode = async (node, data) => {
|
|
|
// console.log("treeData", treeData.value);
|
|
|
// console.log("node", node);
|
|
|
+ collectDir.value = null;
|
|
|
curNode.value = node.data.id;
|
|
|
// console.log("curNode.value", curNode.value);
|
|
|
// console.log("data", data);
|
|
|
@@ -160,8 +163,8 @@ const rightFn = async (node, data, e) => {
|
|
|
const fRes = await getDir(node.parent.data.id);
|
|
|
if (fRes.data.dirType == "2") {
|
|
|
// 父级是组织 不可以编辑
|
|
|
- emit("treeRClick", res.data, null, e,true);
|
|
|
- }else{
|
|
|
+ emit("treeRClick", res.data, null, e, true);
|
|
|
+ } else {
|
|
|
emit("treeRClick", res.data, null, e);
|
|
|
}
|
|
|
// console.log("fRes", fRes);
|
|
|
@@ -219,8 +222,22 @@ watch(
|
|
|
deep: true,
|
|
|
}
|
|
|
);
|
|
|
+watch(
|
|
|
+ () => props.collectId,
|
|
|
+ (newValue, oldValue) => {
|
|
|
+ // console.log("watch", newValue);
|
|
|
+ collectDir.value = newValue;
|
|
|
+ curArr.value.push(newValue);
|
|
|
+ // proxy.$refs["folderTreeRef"].filter(newValue);
|
|
|
+ },
|
|
|
+ {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
+);
|
|
|
onMounted(() => {
|
|
|
getTopDir();
|
|
|
+ // collectDir.value = props.collectId;
|
|
|
|
|
|
// getFileTree();
|
|
|
});
|
|
|
@@ -266,6 +283,9 @@ onMounted(() => {
|
|
|
color: #06286c;
|
|
|
}
|
|
|
}
|
|
|
+.alive {
|
|
|
+ background-color: #f5f7f9;
|
|
|
+}
|
|
|
:deep(.el-tree-node__content) {
|
|
|
height: 36px;
|
|
|
}
|