|
@@ -62,13 +62,13 @@ const props = defineProps({
|
|
|
default: "",
|
|
|
},
|
|
|
});
|
|
|
-const emit = defineEmits(["listfolderClick",'treeRClick']);
|
|
|
+const emit = defineEmits(["listfolderClick", "treeRClick"]);
|
|
|
const treeData = ref();
|
|
|
console.log("treeData", treeData.value);
|
|
|
const curArr = ref([]); //默认展开一级目录
|
|
|
const folderTreeRef = ref();
|
|
|
-const curNode = ref()
|
|
|
-const topId = ref()//顶层的id
|
|
|
+const curNode = ref();
|
|
|
+const topId = ref(); //顶层的id
|
|
|
const defaultProps = ref({
|
|
|
label: "label",
|
|
|
value: "id",
|
|
@@ -100,7 +100,7 @@ function getFileTree() {
|
|
|
const checkoutNode = async (node, data) => {
|
|
|
// console.log("treeData", treeData.value);
|
|
|
// console.log("node", node);
|
|
|
- curNode.value = node.data.id
|
|
|
+ curNode.value = node.data.id;
|
|
|
// console.log("curNode.value", curNode.value);
|
|
|
// console.log("data", data);
|
|
|
let thisNode;
|
|
@@ -133,21 +133,34 @@ const setImg = (remark) => {
|
|
|
return setListImg(remark);
|
|
|
};
|
|
|
const getTopDir = async () => {
|
|
|
- curArr.value = []
|
|
|
+ curArr.value = [];
|
|
|
const res = await documents.getTop(props.spaceType);
|
|
|
- console.log("topres", res);
|
|
|
+ // console.log("topres", res);
|
|
|
curArr.value.push(res.dirId);
|
|
|
- console.log('curArr',curArr.value);
|
|
|
- topId.value = res.dirId
|
|
|
+ // console.log("curArr", curArr.value);
|
|
|
+ topId.value = res.dirId;
|
|
|
return;
|
|
|
};
|
|
|
-const rightFn =async (node, data, e) => {
|
|
|
- // console.log("node", node);
|
|
|
- // console.log("data", data);
|
|
|
+const rightFn = async (node, data, e) => {
|
|
|
+ console.log("node", node);
|
|
|
+ console.log("data", data);
|
|
|
// console.log("e", e);
|
|
|
- if(node.level === 1)return
|
|
|
- const res = await getDir(data.id);
|
|
|
- emit('treeRClick',res.data,null,e)
|
|
|
+ //如果是二级及以后(node.level >= 3)的节点 需要判断父级是不是组织目录来确定是否显示编辑
|
|
|
+ if (node.level === 1) return;
|
|
|
+ if (node.level == 2) {
|
|
|
+ const res = await getDir(data.id);
|
|
|
+ emit("treeRClick", res.data, null, e);
|
|
|
+ } else {
|
|
|
+ const res = await getDir(data.id);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ // console.log("fRes", fRes);
|
|
|
+ }
|
|
|
};
|
|
|
/** 通过条件过滤节点 */
|
|
|
const filterNode = (value, data) => {
|
|
@@ -167,20 +180,20 @@ watch(
|
|
|
expandedNodes = Object.keys(nodesMap).filter(
|
|
|
(key) => nodesMap[key].expanded
|
|
|
);
|
|
|
- }else{
|
|
|
- expandedNodes.push(topId.value)
|
|
|
+ } else {
|
|
|
+ expandedNodes.push(topId.value);
|
|
|
}
|
|
|
console.log("expandedNodes", expandedNodes);
|
|
|
// 把这当从服务器拉取数据
|
|
|
treeData.value = JSON.parse(JSON.stringify(newValue));
|
|
|
// 更新数据后, 有过滤条件的执行过滤, 没有的还原之前的展开状态
|
|
|
setTimeout(() => {
|
|
|
- if (props.searchFolderTree!== "") {
|
|
|
+ if (props.searchFolderTree !== "") {
|
|
|
folderTreeRef.value?.filter(props.searchFolderTree);
|
|
|
} else {
|
|
|
expandedNodes.forEach((key) => (nodesMap[key].expanded = true));
|
|
|
}
|
|
|
- folderTreeRef.value?.setCurrentKey(curNode.value)
|
|
|
+ folderTreeRef.value?.setCurrentKey(curNode.value);
|
|
|
}, 0);
|
|
|
},
|
|
|
{
|