邓洁: 修改用电量

This commit is contained in:
邓洁
2023-12-24 18:08:09 +08:00
parent bd25780f46
commit 73a8e809d9

View File

@@ -60,7 +60,7 @@ let myEcharts = reactive({});
const isVisited = ref(false); const isVisited = ref(false);
const eleData = ref([]) const eleData = ref([])
const electricityConsumptionMonthly = ref() const electricityConsumptionMonthly = ref()
const monthlySavings = ref(5) const monthlySavings = ref(4000)
const length = ref(null); const length = ref(null);
const valueA = ref(); const valueA = ref();
const valueB = ref(monthlySavings.value); const valueB = ref(monthlySavings.value);
@@ -71,7 +71,7 @@ const bgImage = computed(() =>
); );
watch(() => props.eleData, (now) => { watch(() => props.eleData, (now) => {
getBasicData(now.frequencyChangerList) getBasicData(now.frequencyChangerList)
setValue() setValueA()
}, {deep: true}); }, {deep: true});
watch(() => props.list, (now) => { watch(() => props.list, (now) => {
eleData.value.forEach(item => { eleData.value.forEach(item => {
@@ -86,18 +86,18 @@ watch(() => props.list, (now) => {
} }
}) })
}) })
setValue() setValueA()
}, {deep: true}); }, {deep: true});
onMounted(()=>{ onMounted(()=>{
setValueA() setValueA()
setValueB() setValueB()
}) })
const setValueA=()=> { const setValueA=()=> {
let width = (5000 * length.value.offsetHeight) / 10000; let width = (electricityConsumptionMonthly.value * length.value.offsetHeight) / 10000;
valueA.value.style.height = `${width}px`; valueA.value.style.height = `${width}px`;
} }
const setValueB=()=> { const setValueB=()=> {
let width = (8000 * length.value.offsetHeight) / 10000; let width = (4000 * length.value.offsetHeight) / 10000;
valueB.value.style.height = `${width}px`; valueB.value.style.height = `${width}px`;
} }
const getBasicData = (data) => { const getBasicData = (data) => {