87,995
社区成员




{
id: 1,
date: "2016-05-02",
name: "sdsd对数函数的 ",
levels: 1,
address: "上海市普陀区金沙江路 1518 弄",
children: [
{
id: 11,
date: "2016-05-01",
name: "万二份",
levels: 2,
address: "上海市普陀区金沙江路 1519 弄",
children: [
{
id: 111,
date: "2016-05-01",
levels: 3,
name: "王三",
address: "上海市普陀区金沙江路 1519 弄"
}
]
}
]
},
<el-table
:data="tableData"
style="width: 100%;margin-bottom: 20px;"
row-key="id"
stripe
ref="refs"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
sortDelet(row) {
// console.log(this);
console.log(row);
console.log(row.levels);
if (row.levels * 1 == 1) {
this.tableData.splice(this.tableData.indexOf(row), 1);
} else if (row.levels * 1 == 2) {
// debugger;
let child1 = [];
for (let i = 0; i <= this.tableData.length; i++) {
child1 = this.tableData[i].children;
for (let j = 0; j < child1.length; j++) {
if (child1[j].id * 1 == row.id*1) {
child1.splice(child1.indexOf(child1[j]), 1);
}
}
}
} else if (row.levels * 1 == 3) {
let child1 = [];
let child2 = [];
for (let i = 0; i <= this.tableData.length; i++) {
child1 = this.tableData[i].children;
for (let j = 0; j < child1.length; j++) {
child2 = this.tableData[i].children[j].children;
for (let k = 0; k < child2.length; k++) {
if (child2[k].id * 1 == row.id*1) {
child2.splice(child2.indexOf(child2[k]), 1);
}
}
}
}
}
}
let child1 = [];
let child2 = [];