吉安感知网项目-前端
chenyao
2026-04-09 27daa3a1ee539dc474231ccb317756e5da0f2f75
feat:增加table key重新删除
1 files modified
21 ■■■■ changed files
applications/drone-command/src/views/permissionManage/permissionDept/index.vue 21 ●●●● patch | view | raw | blame | history
applications/drone-command/src/views/permissionManage/permissionDept/index.vue
@@ -39,6 +39,7 @@
                <el-table
                    class="command-table"
                    :data="list"
                    :key="tableKey"
                    row-key="id"
                    lazy
                    :load="loadChildren"
@@ -204,6 +205,7 @@
        type: 1,
    })
    ElMessage.success('删除成功')
    refreshTable()
    selectedIds.value = []
    selectedRows.value = []
    const parentIds = Array.from(new Set(rows.map(item => item.parentId).filter(parentId => !isRootParentId(parentId))))
@@ -251,15 +253,28 @@
        })
}
function refreshChildNodes(parentId) {
const tableKey = ref(0)
function refreshTable() {
    tableKey.value++  // 强制重新渲染整个表格
}
async function refreshChildNodes(parentId) {
    const cache = treeResolveMap.get(parentId)
    if (!cache?.resolve) return
    // 先清空
    cache.resolve([])
    await nextTick()
    getChildLazyTree({ parentId })
        .then(res => {
        .then(async res => {
            const children = res?.data?.data ?? []
            if (cache.row) {
                cache.row.hasChildren = children.length > 0
            }
            // cache.resolve(children)
            // 重新填充
            await nextTick()
            cache.resolve(children)
        })
        .catch(() => {
@@ -277,7 +292,7 @@
            lastActionParentRow.value.hasChildren = true
        }
        lastActionParentRow.value = null
        return
        // return
    }
    lastActionParentRow.value = null
    getList()