样式调整

This commit is contained in:
sjl
2024-12-18 15:49:29 +08:00
parent 53ead0e62f
commit 4cfca89895
9 changed files with 280 additions and 156 deletions

View File

@@ -92,7 +92,7 @@
<el-tab-pane :label="tabLabel1" :style="{ height: tabPaneHeight }">
<!-- 列表数据 -->
<div class="container_table" :style="{ height: tableHeight }">
<Table ref="tableRef1" :id='currentId'></Table>
<Table ref="tableRef1" :id='currentId' :isTimeCheck = 'isTimeCheck'></Table>
</div>
</el-tab-pane>
@@ -123,6 +123,7 @@ import type { CollapseModelValue } from "element-plus/es/components/collapse/src
import { type Device } from "@/api/device/interface/device";
import { getBoundPqDevList } from '@/api/plan/plan.ts'
import { CENTERED_ALIGNMENT } from "element-plus/es/components/virtual-list/src/defaults";
import { ResultData } from "@/api/interface";
const dictStore = useDictStore()
const modeStore = useModeStore();
@@ -151,9 +152,9 @@ const tabsHeight = ref('calc(100vh - 538px)'); // 初始高度
const tabPaneHeight = ref('calc(100% - 5px)'); // 初始高度
const tableHeight = ref('calc(100% - 5px)'); // 初始高度
const handleChange = (val: string[]) => {
}
const isTimeCheck = ref<boolean>(false);
const planList = ref<ResultData<Plan.ReqPlan[]>>();
const handleCollapseChange = (val: CollapseModelValue) => {
// 计算新的高度
@@ -264,6 +265,23 @@ const pieRef1 = ref(),
const chartsData1: any = ref([]),
chartsData2: any = ref([]),
chartsData3: any = ref([]);
const findPlanById = (plans: Plan.ReqPlan[], id: string): Plan.ReqPlan | undefined => {
for (const plan of plans) {
if (plan.id === id) {
return plan;
}
console.log('plan.children', plan.children);
if (plan.children) {
const foundPlan = findPlanById(plan.children, id);
if (foundPlan) {
return foundPlan;
}
}
}
return undefined;
};
const getPieData = async (id: string) => {
currentId.value = id; // 设置当前ID
//handleCheckFunction(0)//切换左侧树默认css功能是设备检测
@@ -274,6 +292,13 @@ 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);
if (plan) {
isTimeCheck.value = plan.timeCheck ===1; // 将 1 转换为 true0 转换为 false
} else {
// 处理未找到计划的情况
isTimeCheck.value = false; // 或者其他默认值
}
const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList': [0, 1, 2, 3]});
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[];
// 遍历 boundPqDevList 并更新计数对象
@@ -411,14 +436,17 @@ onBeforeMount(async () => {
code: 0,
state: 0
};
const planList = await getPlanListByPattern(reqPlan);
if (planList.data[0].children[0]) {
currentId.value = planList.data[0].children[0].id;
planList.value = (await getPlanListByPattern(reqPlan)) as ResultData<Plan.ReqPlan[]>;
console.log('qqq',planList.value)
if (planList.value.data[0].children[0]) {
currentId.value = planList.value.data[0].children[0].id;
}
if (chartsInfoRef.value) {
resizeObserver.observe(chartsInfoRef.value);
}
getTree(planList.data);
getTree(planList.value.data);
getPieData(currentId.value);
});