UPDATE: 优化;
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -365,7 +365,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
||||
<el-progress
|
||||
text-inside={true}
|
||||
stroke-width={20}
|
||||
percentage={(scope.row.progress ?? 0) * 100}
|
||||
percentage={Number(((scope.row.progress ?? 0) * 100).toFixed(2))}
|
||||
status="success"
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user