master
fanluyan 1 year ago
parent 18b67d447f
commit 798bba892e

@ -753,27 +753,40 @@ export default {
},
//
deletePic() {
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
deleteApi({
path: this.parentdata.name + "/" + this.currentNodeData.name,
})
.then(() => {
deleteApi({
path: this.parentdata.name + "/" + this.currentNodeData.name,
})
.then((res) => {
console.log(res);
this.$message({
type: "success",
message: "删除成功!",
});
EventBus.$emit("treelist");
localStorage.removeItem("currentData");
})
.catch((err) => {});
.then((res) => {
console.log(res);
this.$message({
type: "success",
message: "删除成功!",
});
//EventBus.$emit("treelist");
localStorage.removeItem("currentData");
})
.catch(() => {});
.catch((err) => {});
// this.$confirm(", ?", "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(() => {
// deleteApi({
// path: this.parentdata.name + "/" + this.currentNodeData.name,
// })
// .then((res) => {
// console.log(res);
// this.$message({
// type: "success",
// message: "!",
// });
// //EventBus.$emit("treelist");
// localStorage.removeItem("currentData");
// })
// .catch((err) => {});
// })
// .catch(() => {});
},
},
};

@ -14,11 +14,11 @@
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span v-if="node.level === 1">
<span>{{ node.label }}</span>
<span>{{ node.label }}</span> ({{ data.children.length }})
</span>
<span v-else-if="node.level === 2">
<i v-if="data.marked" class="el-icon-s-flag"></i>
<span>{{ node.label }}</span>
<span :title="node.label">{{ node.label }}</span>
</span>
</span>
</el-tree>
@ -98,7 +98,7 @@ export default {
})
.catch((err) => {});
},
handleNodeClick(node) {
handleNodeClick(node, data) {
//
if (node.children?.length) {
this.$nextTick(() => {
@ -108,8 +108,18 @@ export default {
}
this.currentNodeKey = node.name;
console.log(node); //
const parentNode = this.$refs.tree.getNode(node).parent.data;
console.log(parentNode); //
console.log(data);
const parentNode = this.findParentNode(data.id, this.piclist);
if (parentNode) {
//
console.log(parentNode); //
} else {
//
console.error("未能找到父节点");
}
//const parentNode = this.$refs.tree.getNode(node).parent;
// //const parentNode = this.$refs.tree.getNode(node).parent.data;
EventBus.$emit("currentNodeData", node);
EventBus.$emit("perentNode", parentNode);
this.defaultExpandedKeys = [parentNode.name];
@ -118,6 +128,18 @@ export default {
this.getlabels();
localStorage.setItem("currentData", JSON.stringify(node));
},
findParentNode(childId, treeData) {
console.log(childId);
console.log(treeData);
//
return treeData.find((parent) => {
console.log(parent);
return (
parent.children &&
parent.children.find((child) => child.$treeNodeId === childId)
);
});
},
getlabels() {
getLabelsApi({
path: this.pathParams,
@ -150,7 +172,7 @@ export default {
</script>
<style lang="less">
.picTree {
width: 300px;
width: 380px;
padding: 10px;
border: 1px solid #dcdfe6;
border-radius: 4px;

Loading…
Cancel
Save