This commit is contained in:
sjl
2025-01-14 15:14:37 +08:00
parent 26cda335c5
commit 23b2974597
7 changed files with 55 additions and 28 deletions

View File

@@ -202,10 +202,6 @@ const tableRef2 = ref()
const currentId = ref('')
watch(
() => form.value,
(val, oldVal) => {
@@ -271,7 +267,6 @@ const findPlanById = (plans: Plan.ReqPlan[], id: string): Plan.ReqPlan | undefin
const getPieData = async (id: string) => {
currentId.value = id // 设置当前ID
// 初始化计数对象
const checkStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0, 3: 0 }
const checkResultCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 }
@@ -306,6 +301,10 @@ const getPieData = async (id: string) => {
reportStateCount[t.reportState]++
}
})
}else{
planName.value = '所选计划:'
}
// 检查 checkStateCount 是否全为 0
@@ -339,6 +338,7 @@ chartsData3.value = [
pieRef3.value.init()
}
const getTree = (data?: any) => {
treeRef.value.getTreeData(data)
}
//前往检测
@@ -434,9 +434,18 @@ onBeforeMount(async () => {
}
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>
if (planList.value.data[0].children[0]) {
currentId.value = planList.value.data[0].children[0].id
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
break; // 确保只执行一次
}
}
// if (planList.value.data[0].children[0]) {
// currentId.value = planList.value.data[0].children[0].id
// console.log('currentId.value',planList.value.data[0])
// }
if (chartsInfoRef.value) {
resizeObserver.observe(chartsInfoRef.value)
}