|
@@ -5,7 +5,8 @@
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
|
|
<el-table-column width="80px">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link v-if="scope.row.hidden" :underline="false" class="el-icon-arrow-right" @click="getList(scope.row)" />
|
|
|
+ <el-link v-if="scope.row.hidden" :underline="false" class="el-icon-arrow-right"
|
|
|
+ @click="getList(scope.row, scope.row.index)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="导航名称" align="center" prop="name" show-overflow-tooltip>
|
|
@@ -165,7 +166,9 @@ export default {
|
|
|
}, {
|
|
|
value: 3,
|
|
|
label: '已失效'
|
|
|
- }]
|
|
|
+ }],
|
|
|
+ // 当前数据缓存
|
|
|
+ index: null
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
@@ -177,7 +180,8 @@ export default {
|
|
|
getTabList() {
|
|
|
tabList().then(res => {
|
|
|
if (res.code === 0) {
|
|
|
- res.data.map(i => {
|
|
|
+ res.data.map((i, index) => {
|
|
|
+ i.index = index
|
|
|
i.hidden = true
|
|
|
i.children = []
|
|
|
})
|
|
@@ -197,8 +201,8 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 首次获取二级列表
|
|
|
- getList(row) {
|
|
|
- let e = this.tableData[row.tabIndex - 1]
|
|
|
+ getList(row, index) {
|
|
|
+ let e = this.tableData[index]
|
|
|
list(row.id).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
if (res.data.length > 0) {
|
|
@@ -222,7 +226,7 @@ export default {
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success('提交成功')
|
|
|
this.cancel()
|
|
|
- this.getTabList()
|
|
|
+ this.getList(this.tableData[this.index], this.index)
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
@@ -240,6 +244,7 @@ export default {
|
|
|
|
|
|
// 弹窗
|
|
|
getDialog(title, row) {
|
|
|
+ this.index = this.tableData.findIndex(i => i.id == row.id)
|
|
|
this.title = title
|
|
|
this.dialogVisible = true
|
|
|
this.dialogForm.categoryId = row.id
|
|
@@ -272,10 +277,11 @@ export default {
|
|
|
this.$confirm(`是否删除?`, '提醒', {
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
+ let index = this.tableData.findIndex(i => i.id == row.categoryId)
|
|
|
remove(row.lv, row.id).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
this.$message.success('删除成功!')
|
|
|
- this.getTabList()
|
|
|
+ this.getList(this.tableData[index], index)
|
|
|
}
|
|
|
})
|
|
|
}).catch(() => { })
|