340a5a58 by zhaoqian

Merge remote-tracking branch 'origin/master'

2 parents decc474c 1665cd18
......@@ -79,13 +79,22 @@ export default {
}
},
openMenu(e, item) {
if (item.isZD!=undefined) {
if (item.zdbsm) {
var x = e.pageX;
var y = e.pageY;
this.$emit("changeIsZD", item.isZD);
this.$emit("changeIsZD", true);
this.$emit("changeTop", y);
this.$emit("changeLeft", x);
this.$emit("changeVisible", true);
} else if (item.zrzbsm) {
var x = e.pageX;
var y = e.pageY;
this.$emit("changeIsZD", false);
this.$emit("changeTop", y);
this.$emit("changeLeft", x);
this.$emit("changeVisible", true);
} else {
return;
}
// this.top = y;
// this.left = x;
......
......@@ -34,10 +34,10 @@
<lineItem
v-if="item.expand && item.children.length > 0"
v-on="$listeners"
@changeTop="changeTop"
@changeLeft="changeLeft"
@changeVisible="changeVisible"
@changeIsZD="changeIsZD"
@changeTop="changeTop"
@changeLeft="changeLeft"
@changeVisible="changeVisible"
@changeIsZD="changeIsZD"
:list="item.children"
:visible="visible"
:size="size"
......@@ -78,8 +78,8 @@ export default {
formatData: [],
visible: false,
top: 0,
left: 0,
isZD:true
left: 0,
isZD: true,
};
},
watch: {
......@@ -91,6 +91,7 @@ export default {
created() {
console.log("lineTree create");
this.preDealData(this.pd);
this.expandTreeItemById(["6b5af49d803f97baf06afb897de257f5"]);
},
methods: {
......@@ -109,17 +110,20 @@ export default {
},
preDealData(list) {
list.forEach((x) => {
if (!x.expand) this.$set(x, "expand", false);
if (x.children && x.children.length > 0) this.preDealData(x.children);
if (!x.expand) this.$set(x, "expand", true);
if (x.children && x.children.length > 0) {
this.preDealData(x.children);
}
});
return list;
},
// 根据id展开树的具体项
expandTreeItemById(idList) {
debugger;
let _this = this;
function loopTree(list) {
list.forEach((x) => {
if (idList.includes(x.id)) {
if (idList.includes(x.zdbsm)) {
_this.$set(x, "expand", true);
} else {
_this.$set(x, "expand", false);
......@@ -129,6 +133,7 @@ export default {
return list;
}
this.formatData = loopTree(this.pd);
console.log(this.formatData, "this.formatData");
},
itemClick(item) {
item.expand = !item.expand;
......