This commit is contained in:
BianLzhaoMin 2026-02-04 15:55:39 +08:00
parent 2335488836
commit 7c60847f46
2 changed files with 77 additions and 7 deletions

View File

@ -535,6 +535,9 @@ const managerDialog = reactive({
type: 'plan', // 'plan', 'actual', 'highAltitude', 'ground', 'actual_highAltitude', 'actual_ground'
})
// selection-change
const isSyncingSelection = ref(false)
//
const personList = computed(() => {
return (personnelCommonOptions.value || []).map((item) => ({
@ -593,6 +596,7 @@ const selectedManagerNames = computed(() => {
// managerDialog.selected
const syncTableSelection = () => {
if (!personTableRef.value || !managerDialogConfig.outerVisible) return
isSyncingSelection.value = true
nextTick(() => {
//
personTableRef.value.clearSelection()
@ -603,6 +607,10 @@ const syncTableSelection = () => {
personTableRef.value.toggleRowSelection(row, true)
}
})
// selection-change
nextTick(() => {
isSyncingSelection.value = false
})
})
}
@ -649,6 +657,9 @@ const onOpenPersonPicker = async (type = 'plan', subType = null) => {
}
const onManagerSelectionChange = (rows) => {
//
if (isSyncingSelection.value) return
// ID
const currentFilteredIds = new Set(filteredPersons.value.map((row) => row.id))
@ -667,14 +678,29 @@ const onManagerSelectionChange = (rows) => {
const onRemoveManager = (item) => {
managerDialog.selected = managerDialog.selected.filter((row) => row.id !== item.id)
if (personTableRef.value) {
const target = personList.value.find((row) => row.id === item.id)
if (target) personTableRef.value.toggleRowSelection(target, false)
//
const target =
filteredPersons.value.find((row) => row.id === item.id) ||
personList.value.find((row) => row.id === item.id)
if (target) {
isSyncingSelection.value = true
personTableRef.value.toggleRowSelection(target, false)
nextTick(() => {
isSyncingSelection.value = false
})
}
}
}
const onClearManagers = () => {
managerDialog.selected = []
if (personTableRef.value) personTableRef.value.clearSelection()
if (personTableRef.value) {
isSyncingSelection.value = true
personTableRef.value.clearSelection()
nextTick(() => {
isSyncingSelection.value = false
})
}
}
const onConfirmManager = () => {
@ -944,6 +970,14 @@ watch(
{ immediate: true },
)
watch(
() => managerDialogConfig.outerVisible,
(newVisible) => {
if (!newVisible) {
managerDialog.keyword = ''
}
},
)
// onMounted(() => {
// if (route.query.id) {
// getDetail()

View File

@ -567,7 +567,7 @@
</el-col>
</el-row>
<el-row class="common-btn-row fixed-bottom">
<ComButton plain type="info" @click="managerDialog.visible = false">
<ComButton plain type="info" @click="onCloseDialogOuter(false)">
取消
</ComButton>
<ComButton type="primary" @click="onConfirmManager">确定</ComButton>
@ -849,6 +849,9 @@ const managerDialog = reactive({
selected: [],
})
// selection-change
const isSyncingSelection = ref(false)
//
const personList = computed(() => {
return (personnelCommonOptions.value || []).map((item) => ({
@ -880,6 +883,7 @@ const selectedManagerNames = computed(() =>
// managerDialog.selected
const syncTableSelection = () => {
if (!personTableRef.value || !managerDialog.visible) return
isSyncingSelection.value = true
nextTick(() => {
//
personTableRef.value.clearSelection()
@ -890,6 +894,10 @@ const syncTableSelection = () => {
personTableRef.value.toggleRowSelection(row, true)
}
})
// selection-change
nextTick(() => {
isSyncingSelection.value = false
})
})
}
@ -912,6 +920,9 @@ const onOpenPersonPicker = async () => {
}
const onManagerSelectionChange = (rows) => {
//
if (isSyncingSelection.value) return
// ID
const currentFilteredIds = new Set(filteredPersons.value.map((row) => row.id))
@ -930,14 +941,29 @@ const onManagerSelectionChange = (rows) => {
const onRemoveManager = (item) => {
managerDialog.selected = managerDialog.selected.filter((row) => row.id !== item.id)
if (personTableRef.value) {
const target = personList.value.find((row) => row.id === item.id)
if (target) personTableRef.value.toggleRowSelection(target, false)
//
const target =
filteredPersons.value.find((row) => row.id === item.id) ||
personList.value.find((row) => row.id === item.id)
if (target) {
isSyncingSelection.value = true
personTableRef.value.toggleRowSelection(target, false)
nextTick(() => {
isSyncingSelection.value = false
})
}
}
}
const onClearManagers = () => {
managerDialog.selected = []
if (personTableRef.value) personTableRef.value.clearSelection()
if (personTableRef.value) {
isSyncingSelection.value = true
personTableRef.value.clearSelection()
nextTick(() => {
isSyncingSelection.value = false
})
}
}
const onConfirmManager = () => {
@ -1130,6 +1156,16 @@ watch(
{ immediate: true },
)
watch(
() => managerDialogConfig.outerVisible,
(newVisible) => {
if (!newVisible) {
managerDialog.keyword = ''
}
},
{ immediate: true },
)
// onMounted(() => {
// getDetail()
// })