xq commit:"完成了筛选"
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<div class="right-menu flex align-center">
|
<div class="right-menu flex align-center">
|
||||||
<template v-if="appStore.device !== 'mobile'">
|
<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-option v-for="(p, index) in programList" :key="index" :value="p.nbqId" :label="p.projectBrief"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select
|
<el-select
|
||||||
@ -219,8 +219,8 @@ function getAllList() {
|
|||||||
projectBrief: item.projectBrief
|
projectBrief: item.projectBrief
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
programName.value = programList.value[0].projectBrief;
|
// programName.value = programList.value[0].projectBrief;
|
||||||
programId.value = programList.value[0].nbqId;
|
// programId.value = programList.value[0].nbqId;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,13 @@ import { defineStore } from 'pinia';
|
|||||||
interface ProgramState {
|
interface ProgramState {
|
||||||
programID: string;
|
programID: string;
|
||||||
personProgramTemp: any;
|
personProgramTemp: any;
|
||||||
|
totalArr: any;
|
||||||
}
|
}
|
||||||
const useProgram = defineStore('program', {
|
const useProgram = defineStore('program', {
|
||||||
state: (): ProgramState => ({
|
state: (): ProgramState => ({
|
||||||
programID: '',
|
programID: '',
|
||||||
personProgramTemp: []
|
personProgramTemp: [],
|
||||||
|
totalArr: []
|
||||||
}),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
@ -17,6 +19,9 @@ const useProgram = defineStore('program', {
|
|||||||
updateTemp(arr: any) {
|
updateTemp(arr: any) {
|
||||||
console.info(arr);
|
console.info(arr);
|
||||||
this.personProgramTemp = arr;
|
this.personProgramTemp = arr;
|
||||||
|
},
|
||||||
|
updateTotalArr(arr: any) {
|
||||||
|
this.totalArr = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1185,8 +1185,9 @@ import {
|
|||||||
import { InverterVO, InverterQuery, InverterForm, HistoryInverterForm } from '@/api/business/inverter/types';
|
import { InverterVO, InverterQuery, InverterForm, HistoryInverterForm } from '@/api/business/inverter/types';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
|
import { useProgram } from '@/store/modules/program';
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const programState = useProgram();
|
||||||
const inverterList = ref<InverterVO[]>([]);
|
const inverterList = ref<InverterVO[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
@ -1196,6 +1197,28 @@ const single = ref(true);
|
|||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
const total = ref(0);
|
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 queryFormRef = ref<ElFormInstance>();
|
||||||
const inverterFormRef = ref<ElFormInstance>();
|
const inverterFormRef = ref<ElFormInstance>();
|
||||||
const inverterFormRef2 = ref<ElFormInstance>();
|
const inverterFormRef2 = ref<ElFormInstance>();
|
||||||
@ -1450,6 +1473,7 @@ const getList = async () => {
|
|||||||
projectName: getProjectName(item.projectId)
|
projectName: getProjectName(item.projectId)
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
programState.updateTotalArr(inverterList.value);
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
@ -1459,7 +1483,6 @@ function getProjectName(a: any) {
|
|||||||
if (a !== '0') {
|
if (a !== '0') {
|
||||||
programList.value.forEach((item) => {
|
programList.value.forEach((item) => {
|
||||||
if (item.projectId === a) {
|
if (item.projectId === a) {
|
||||||
console.info(item);
|
|
||||||
name = item.projectBrief;
|
name = item.projectBrief;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user