首页隐藏子计划,计划列表子计划设备管理

This commit is contained in:
sjl
2025-07-22 14:56:58 +08:00
parent f81503091d
commit 1f37cc567c
11 changed files with 204 additions and 95 deletions

View File

@@ -300,7 +300,8 @@ const getPieData = async (id: string) => {
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 }
if (id) {
const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
const plan = findPlanById(planList.value?.data || [], id)
const plan = findPlanById(planList.value, id)
console.log('所选计划:',plan)
planName.value = '所选计划:' + plan.name
select_Plan.value = plan
@@ -493,22 +494,30 @@ const initPlan = async () => {
dataRule: '',
testItemNameStr:'',
testItems: [],
standardDevIdList:[],
standardDevIds:[],
standardDevMap: new Map<string, number>(),
}
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>
planList.value = planList.value.data.map((item: any) => {
if (item.children) {
item.children = item.children.filter(child => child.pid === '0');
}
return item;
});
}
onBeforeMount(async () => {
await initPlan()
for (let i = 0; i < planList.value.data.length; i++) {
if (Array.isArray(planList.value.data[i].children) && planList.value.data[i].children.length > 0) {
currentId.value = planList.value.data[i].children[0].id; // 直接赋值第一个 children 的 id
console.log(planList.value)
for (let i = 0; i < planList.value.length; i++) {
if (Array.isArray(planList.value[i].children) && planList.value[i].children.length > 0) {
currentId.value = planList.value[i].children[0].id; // 直接赋值第一个 children 的 id
break; // 确保只执行一次
}
}
console.log('planList.valuecurrentId.value', currentId.value)
// if (planList.value.data[0].children[0]) {
// currentId.value = planList.value.data[0].children[0].id
// console.log('currentId.value',planList.value.data[0])
@@ -517,8 +526,7 @@ onBeforeMount(async () => {
if (chartsInfoRef.value) {
resizeObserver.observe(chartsInfoRef.value)
}
getTree(planList.value.data)
getTree(planList.value)
getPieData(currentId.value)
})
@@ -532,7 +540,7 @@ const handleBatchGenerate = async () => {
// console.log('批量生成按钮被点击了');
// 在这里添加其他逻辑,比如显示对话框、更新状态等
await initPlan()
treeRef.value.clickTableToTree(planList.value.data,currentId.value)
treeRef.value.clickTableToTree(planList.value,currentId.value)
getPieData(currentId.value)
if (form.value.activeTabs === 0)//设备检测