fix(review-meeting): 修复专家搜索导致已选项丢失

pull/874/head
Codewoc 2026-04-02 09:13:19 +08:00
parent 0194af250d
commit 2c70c062a2
1 changed files with 18 additions and 18 deletions

View File

@ -42,12 +42,13 @@
v-if="!disabled" v-if="!disabled"
ref="tableRef" ref="tableRef"
:data="filteredExperts" :data="filteredExperts"
row-key="id"
border border
size="small" size="small"
max-height="300" max-height="300"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="50" align="center" /> <el-table-column type="selection" :reserve-selection="true" width="50" align="center" />
<el-table-column label="姓名" prop="nickname" width="100" /> <el-table-column label="姓名" prop="nickname" width="100" />
<el-table-column label="单位" prop="deptName" show-overflow-tooltip /> <el-table-column label="单位" prop="deptName" show-overflow-tooltip />
<el-table-column label="职务" prop="position" width="160" show-overflow-tooltip /> <el-table-column label="职务" prop="position" width="160" show-overflow-tooltip />
@ -111,10 +112,7 @@ const selectedExperts = computed(() =>
props.experts.filter((e) => props.modelValue.includes(e.id)) props.experts.filter((e) => props.modelValue.includes(e.id))
) )
// const syncTableSelection = async () => {
watch(
() => props.modelValue,
async () => {
await nextTick() await nextTick()
if (!tableRef.value) return if (!tableRef.value) return
isUpdating.value = true isUpdating.value = true
@ -125,9 +123,11 @@ watch(
} }
}) })
isUpdating.value = false isUpdating.value = false
}, }
{ immediate: true }
) // modelValue
watch(() => props.modelValue, syncTableSelection, { immediate: true })
watch(filteredExperts, syncTableSelection)
const handleSelectionChange = (selected: Expert[]) => { const handleSelectionChange = (selected: Expert[]) => {
if (isUpdating.value) return if (isUpdating.value) return