diff --git a/frontend/src/views/plan/planList/components/childrenPlan.vue b/frontend/src/views/plan/planList/components/childrenPlan.vue index 7c87ed1..5e146e0 100644 --- a/frontend/src/views/plan/planList/components/childrenPlan.vue +++ b/frontend/src/views/plan/planList/components/childrenPlan.vue @@ -416,7 +416,7 @@ const renderTabs = () => { }) } // 子计划 tabs - if (planFormContent.value?.children?.length > 0) { + if (planFormContent.value && planFormContent.value.children && planFormContent.value.children?.length > 0) { planFormContent.value.children.forEach((child, index) => { tabs.push({ title: child.name, @@ -445,7 +445,8 @@ const unbindDevice = (row: any) => { await subPlanBindDev({ planId: row.planId, devIds: [row.id], bindFlag: 0 }) //解绑 0 绑定 1 // 👇 更新数据(例如清空 state 字段) row.state = '/' - proTable.value?.getTableList() + await proTable.value?.getTableList() + await props.refreshTable!() // 可选:刷新表格或提交接口 ElMessage.success('解绑成功') }) @@ -500,6 +501,7 @@ const distribute = (childPlan: Plan.ResPlan, scope: any) => { .then(async () => { await subPlanBindDev({ planId: childPlan.id, devIds: scope.selectedListIds, bindFlag: 1 }) //解绑 0 绑定 1 proTable.value?.getTableList() + await props.refreshTable!() ElMessage.success('分配成功') }) .catch(() => { diff --git a/frontend/src/views/plan/planList/components/devSelect.vue b/frontend/src/views/plan/planList/components/devSelect.vue index d4e6765..5f5c586 100644 --- a/frontend/src/views/plan/planList/components/devSelect.vue +++ b/frontend/src/views/plan/planList/components/devSelect.vue @@ -367,6 +367,7 @@ const initTree = (data: Device[]) => { filter.value.groupBy ) defaultCheckedKeys.value = data.filter(item => item.checked).map(item => item.id) + modelValue.value = defaultCheckedKeys.value // 统计数据 statistics.value.checked = defaultCheckedKeys.value.length statistics.value.total = data.length diff --git a/frontend/src/views/plan/planList/components/planPopup.vue b/frontend/src/views/plan/planList/components/planPopup.vue index 6a6cb0b..ea39a9b 100644 --- a/frontend/src/views/plan/planList/components/planPopup.vue +++ b/frontend/src/views/plan/planList/components/planPopup.vue @@ -460,8 +460,9 @@ const generateData = () => { i.manufacturer = manufacturer.name } } - i.checked = boundPqDevIds.includes(i.id) - i.disabled = i.checkState != 0 + i.checked = boundPqDevIds.length > 0 ? boundPqDevIds.includes(i.id) : false + i.disabled = i.checkState ? i.checkState != 0 : false + if (allDisabled.value) { i.disabled = true } @@ -668,12 +669,12 @@ const save = () => { if (planType.value == 1) { formContent.fatherPlanId = formContent.id formContent.id = '' - formContent.memberIds = [formContent.memberIds?.toString()] + formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : [] await addPlan(formContent) emit('update:tab') // 编辑子计划 } else if (planType.value == 2) { - formContent.memberIds = [formContent.memberIds?.toString()] + formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : [] await updatePlan(formContent) emit('update:tab') console.log('更新子计划', formContent) diff --git a/frontend/src/views/plan/planList/index.vue b/frontend/src/views/plan/planList/index.vue index 79d5f37..67e73c6 100644 --- a/frontend/src/views/plan/planList/index.vue +++ b/frontend/src/views/plan/planList/index.vue @@ -365,7 +365,7 @@ const columns = reactive[]>([ )