xq commit:"完成了筛选"

This commit is contained in:
2025-07-11 18:46:20 +08:00
parent 753a04f8a6
commit f019a174bd
3 changed files with 34 additions and 6 deletions

View File

@ -1185,8 +1185,9 @@ import {
import { InverterVO, InverterQuery, InverterForm, HistoryInverterForm } from '@/api/business/inverter/types';
import { ref } from 'vue';
import * as echarts from 'echarts';
import { useProgram } from '@/store/modules/program';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const programState = useProgram();
const inverterList = ref<InverterVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
@ -1196,6 +1197,28 @@ const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const chosenProgram = computed(() => {
return programState.programID;
});
const totalArr = computed(() => {
return programState.totalArr;
});
watch(
chosenProgram,
(nv, ov) => {
if (nv !== ov) {
inverterList.value = [];
const a = totalArr.value.filter((item) => item.projectId === nv || item.projectId === '0');
console.info(nv);
console.info(a);
a.forEach((item) => {
inverterList.value.push(item);
});
}
},
{ immediate: true }
);
const queryFormRef = ref<ElFormInstance>();
const inverterFormRef = ref<ElFormInstance>();
const inverterFormRef2 = ref<ElFormInstance>();
@ -1450,6 +1473,7 @@ const getList = async () => {
projectName: getProjectName(item.projectId)
};
});
programState.updateTotalArr(inverterList.value);
total.value = res.total;
loading.value = false;
};
@ -1459,7 +1483,6 @@ function getProjectName(a: any) {
if (a !== '0') {
programList.value.forEach((item) => {
if (item.projectId === a) {
console.info(item);
name = item.projectBrief;
}
});