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

@ -6,7 +6,7 @@
<div class="right-menu flex align-center">
<template v-if="appStore.device !== 'mobile'">
<el-select class="program-list" :placeholder="programName" @change="updateProgram">
<el-select class="program-list" :placeholder="programName" @change="updateProgram" clearable>
<el-option v-for="(p, index) in programList" :key="index" :value="p.nbqId" :label="p.projectBrief"></el-option>
</el-select>
<el-select
@ -219,8 +219,8 @@ function getAllList() {
projectBrief: item.projectBrief
};
});
programName.value = programList.value[0].projectBrief;
programId.value = programList.value[0].nbqId;
// programName.value = programList.value[0].projectBrief;
// programId.value = programList.value[0].nbqId;
});
}

View File

@ -3,11 +3,13 @@ import { defineStore } from 'pinia';
interface ProgramState {
programID: string;
personProgramTemp: any;
totalArr: any;
}
const useProgram = defineStore('program', {
state: (): ProgramState => ({
programID: '',
personProgramTemp: []
personProgramTemp: [],
totalArr: []
}),
actions: {
@ -17,6 +19,9 @@ const useProgram = defineStore('program', {
updateTemp(arr: any) {
console.info(arr);
this.personProgramTemp = arr;
},
updateTotalArr(arr: any) {
this.totalArr = arr;
}
}
});

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;
}
});