UPDATE: 优化;
This commit is contained in:
@@ -416,7 +416,7 @@ const renderTabs = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 子计划 tabs
|
// 子计划 tabs
|
||||||
if (planFormContent.value?.children?.length > 0) {
|
if (planFormContent.value && planFormContent.value.children && planFormContent.value.children?.length > 0) {
|
||||||
planFormContent.value.children.forEach((child, index) => {
|
planFormContent.value.children.forEach((child, index) => {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
title: child.name,
|
title: child.name,
|
||||||
@@ -445,7 +445,8 @@ const unbindDevice = (row: any) => {
|
|||||||
await subPlanBindDev({ planId: row.planId, devIds: [row.id], bindFlag: 0 }) //解绑 0 绑定 1
|
await subPlanBindDev({ planId: row.planId, devIds: [row.id], bindFlag: 0 }) //解绑 0 绑定 1
|
||||||
// 👇 更新数据(例如清空 state 字段)
|
// 👇 更新数据(例如清空 state 字段)
|
||||||
row.state = '/'
|
row.state = '/'
|
||||||
proTable.value?.getTableList()
|
await proTable.value?.getTableList()
|
||||||
|
await props.refreshTable!()
|
||||||
// 可选:刷新表格或提交接口
|
// 可选:刷新表格或提交接口
|
||||||
ElMessage.success('解绑成功')
|
ElMessage.success('解绑成功')
|
||||||
})
|
})
|
||||||
@@ -500,6 +501,7 @@ const distribute = (childPlan: Plan.ResPlan, scope: any) => {
|
|||||||
.then(async () => {
|
.then(async () => {
|
||||||
await subPlanBindDev({ planId: childPlan.id, devIds: scope.selectedListIds, bindFlag: 1 }) //解绑 0 绑定 1
|
await subPlanBindDev({ planId: childPlan.id, devIds: scope.selectedListIds, bindFlag: 1 }) //解绑 0 绑定 1
|
||||||
proTable.value?.getTableList()
|
proTable.value?.getTableList()
|
||||||
|
await props.refreshTable!()
|
||||||
ElMessage.success('分配成功')
|
ElMessage.success('分配成功')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|||||||
@@ -367,6 +367,7 @@ const initTree = (data: Device[]) => {
|
|||||||
filter.value.groupBy
|
filter.value.groupBy
|
||||||
)
|
)
|
||||||
defaultCheckedKeys.value = data.filter(item => item.checked).map(item => item.id)
|
defaultCheckedKeys.value = data.filter(item => item.checked).map(item => item.id)
|
||||||
|
modelValue.value = defaultCheckedKeys.value
|
||||||
// 统计数据
|
// 统计数据
|
||||||
statistics.value.checked = defaultCheckedKeys.value.length
|
statistics.value.checked = defaultCheckedKeys.value.length
|
||||||
statistics.value.total = data.length
|
statistics.value.total = data.length
|
||||||
|
|||||||
@@ -460,8 +460,9 @@ const generateData = () => {
|
|||||||
i.manufacturer = manufacturer.name
|
i.manufacturer = manufacturer.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i.checked = boundPqDevIds.includes(i.id)
|
i.checked = boundPqDevIds.length > 0 ? boundPqDevIds.includes(i.id) : false
|
||||||
i.disabled = i.checkState != 0
|
i.disabled = i.checkState ? i.checkState != 0 : false
|
||||||
|
|
||||||
if (allDisabled.value) {
|
if (allDisabled.value) {
|
||||||
i.disabled = true
|
i.disabled = true
|
||||||
}
|
}
|
||||||
@@ -668,12 +669,12 @@ const save = () => {
|
|||||||
if (planType.value == 1) {
|
if (planType.value == 1) {
|
||||||
formContent.fatherPlanId = formContent.id
|
formContent.fatherPlanId = formContent.id
|
||||||
formContent.id = ''
|
formContent.id = ''
|
||||||
formContent.memberIds = [formContent.memberIds?.toString()]
|
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
||||||
await addPlan(formContent)
|
await addPlan(formContent)
|
||||||
emit('update:tab')
|
emit('update:tab')
|
||||||
// 编辑子计划
|
// 编辑子计划
|
||||||
} else if (planType.value == 2) {
|
} else if (planType.value == 2) {
|
||||||
formContent.memberIds = [formContent.memberIds?.toString()]
|
formContent.memberIds = formContent.memberIds ? [formContent.memberIds?.toString()] : []
|
||||||
await updatePlan(formContent)
|
await updatePlan(formContent)
|
||||||
emit('update:tab')
|
emit('update:tab')
|
||||||
console.log('更新子计划', formContent)
|
console.log('更新子计划', formContent)
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ const columns = reactive<ColumnProps<Plan.ReqPlan>[]>([
|
|||||||
<el-progress
|
<el-progress
|
||||||
text-inside={true}
|
text-inside={true}
|
||||||
stroke-width={20}
|
stroke-width={20}
|
||||||
percentage={(scope.row.progress ?? 0) * 100}
|
percentage={Number(((scope.row.progress ?? 0) * 100).toFixed(2))}
|
||||||
status="success"
|
status="success"
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user