机构管理:机构树显示逻辑修改
This commit is contained in:
parent
45d662dac5
commit
a2a9047349
@ -39,9 +39,10 @@
|
||||
v-model="formModel[item.prop]"
|
||||
:disabled="formDisabled"
|
||||
lazy
|
||||
:data="treeData"
|
||||
:load="loadSelectTreeData"
|
||||
check-strictly
|
||||
value-key="id"
|
||||
node-key="id"
|
||||
:props="treeSelectReplaceProps"
|
||||
:placeholder="item.placeholder"
|
||||
></el-tree-select>
|
||||
@ -346,7 +347,9 @@ const submitAddForm = () => {
|
||||
ElMessage.success('编辑成功')
|
||||
getInstitutionList()
|
||||
dialogVible.value = false
|
||||
refreshTreeData(formModel.value.parentOrgId)
|
||||
refreshTreeData(rightClickMenuData.value!.parentOrgId).then(() => {
|
||||
refreshTreeData(formModel.value.parentOrgId)
|
||||
})
|
||||
} else {
|
||||
ElMessage.error(res?.msg ?? '编辑失败')
|
||||
}
|
||||
@ -466,7 +469,6 @@ const treeReplaceProps = {
|
||||
}
|
||||
const treeSelectReplaceProps = {
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
children: 'children',
|
||||
}
|
||||
const loadTreeData = (node: Node, resolve: any) => {
|
||||
@ -487,6 +489,8 @@ const loadTreeData = (node: Node, resolve: any) => {
|
||||
})
|
||||
}
|
||||
const loadSelectTreeData = (node: Node, resolve: any) => {
|
||||
console.log(node)
|
||||
|
||||
if (node.level === 0) {
|
||||
return getTreeData(null)
|
||||
.then((res) => {
|
||||
@ -527,6 +531,8 @@ const initData = () => {
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
treeData.value = [...res]
|
||||
console.log(treeData.value)
|
||||
|
||||
nextTick(() => {
|
||||
treeRef.value?.setCurrentKey(res[0]?.id!, false)
|
||||
clickTreeMenuData.value = res[0]
|
||||
@ -543,15 +549,18 @@ const initData = () => {
|
||||
}
|
||||
const clickTreeMenuData = ref<getTreeDataReturnType>()
|
||||
const refreshTreeData = (parentOrgId: string | number | null) => {
|
||||
const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId
|
||||
getTreeData(data).then((res) => {
|
||||
console.log('res,', res)
|
||||
console.log(data)
|
||||
if (data) {
|
||||
treeRef.value?.updateKeyChildren(parentOrgId!, res)
|
||||
} else {
|
||||
treeData.value = [...res]
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
const data = parentOrgId === 0 || parentOrgId === '0' ? null : parentOrgId
|
||||
getTreeData(data).then((res) => {
|
||||
console.log('res,', res)
|
||||
console.log(data)
|
||||
if (data) {
|
||||
treeRef.value?.updateKeyChildren(parentOrgId!, res)
|
||||
} else {
|
||||
treeData.value = [...res]
|
||||
}
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
}
|
||||
const treeNodeClick = (nodeData: getTreeDataReturnType, node: Node) => {
|
||||
|
Loading…
Reference in New Issue
Block a user