123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <template>
- <div
- class="lastMonth"
- :class="[screenType === 'hor' ? 'horizontalClass ' : 'verLastClass ']"
- >
- <div class="subhead-title">
- <span>上月总能耗</span>
- </div>
- <div class="saveEnergy">
- <span class="backImage">节能<span class="value">{{ lastAllComputed.energyCompare }}%</span></span>
- </div>
- <div class="energySave">
- <div class="textDiv">
- <span>项目能耗</span><span class="value">{{ lastAllComputed.energySaving }}kWh</span>
- </div>
- <div
- class="saveBack"
- :style="{ width: lastAllComputed.energyCompare + '%' }"
- ></div>
- </div>
- <div class="energyTotal">
- <div class="textDiv">
- <span>基准能耗</span><span class="value">{{ lastAllComputed.energyTotal }}kWh</span>
- </div>
- <div
- class="totalBack"
- :style="{ width: widthBase }"
- ></div>
- </div>
- </div>
- </template>
- <script lang="ts">
- import {
- ref,
- defineComponent,
- reactive,
- toRefs,
- onMounted,
- computed,
- } from "vue";
- import { queryLastEnergy } from "@/api/index";
- import useProjectStore from "@/store/useProjectStore";
- import { storeToRefs, mapState } from "pinia";
- export default defineComponent({
- props: {
- screenType: {
- type: String,
- },
- },
- setup(props, contx) {
-
- const projectStore = useProjectStore();
-
- const allData = reactive({
- widthBase: "0%",
- });
- const lastAllComputed = computed(() => {
- const lastAllEnergy = projectStore.lastAllEnergy;
- var lastObj = {
- energySaving: lastAllEnergy.energySaving
- ? lastAllEnergy.energySaving.toFixed(1)
- : lastAllEnergy.energySaving,
- energyTotal: lastAllEnergy.energyTotal
- ? lastAllEnergy.energyTotal.toFixed(1)
- : lastAllEnergy.energyTotal,
- energyCompare: lastAllEnergy.energyCompare
- ? (lastAllEnergy.energyCompare * 100).toFixed(0)
- : lastAllEnergy.energyCompare,
- };
- return lastObj;
- });
- projectStore.$subscribe((mutation, state) => {
-
- allData.widthBase = "100%";
- });
- onMounted(() => {
- projectStore.setLastAllEnergy();
- });
- return { ...toRefs(allData), lastAllComputed, projectStore };
- },
- computed: {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- },
- });
- </script>
- <style scoped lang="scss">
- .lastMonth {
- height: 100%;
- backdrop-filter: blur(20px);
- background: rgba(100, 108, 130, 0.06);
- border-radius: 20px;
- .saveEnergy {
- color: #f7e6cd;
- font-size: 46px;
- height: calc(100% - 195px);
- display: flex;
- justify-content: center;
- align-items: center;
- font-weight: 600;
- font-family: Persagy;
- .backImage {
- background-image: url("@/assets/image/horImg/lastAllLight.png");
- background-repeat: no-repeat;
- background-position: center bottom;
- background-size: 100%;
- padding-bottom: 5px;
- text-shadow: 0px 0px 8px rgba(255, 255, 255, 0.4);
- .value {
- font-weight: 700;
- font-size: 48px;
- margin-left: 2px;
- }
- }
- }
- .energySave {
- color: #e0c29b;
- font-size: 20px;
- padding-bottom: 32px;
- padding-left: 24px;
- padding-right: 24px;
- height: 85px;
- box-sizing: border-box;
- }
- .energyTotal {
- color: #cbcdda;
- font-size: 20px;
- height: 50px;
- padding-left: 24px;
- padding-right: 24px;
- box-sizing: border-box;
- }
- .textDiv {
- display: flex;
- justify-content: space-between;
- padding-bottom: 8px;
- font-family: Persagy;
- }
- .saveBack {
- height: 15px;
- background-image: url("@/assets/image/horImg/lastGold.svg");
- transition: width 0.8s linear;
- width: 0;
- }
- .totalBack {
- height: 15px;
- background-image: url("@/assets/image/horImg/lastGray.svg");
- transition: width 0.8s linear;
- width: 0;
- }
- }
- .verLastClass {
-
- height: 28%;
- box-sizing: border-box;
- padding: 0 36px 40px;
- }
- </style>
|