123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <script>
- import Card from "@/components/common/card.vue";
- import CoreData from "@/components/common/coreData.vue";
- import Query from "@/components/common/query.vue";
- import CarbonPrintEmissionChart from "@/components/doubleCarbon/print/charts/carbonPrintEmissionChart.vue";
- import CarbonPrintQuotaChart from "@/components/doubleCarbon/print/charts/carbonPrintQuotaChart.vue";
- import apiCarbonPrint from "@/api/carbon/apiCarbonPrint";
- export default {
- components: {
- Card,
- CoreData,
- Query,
- CarbonPrintEmissionChart,
- CarbonPrintQuotaChart,
- },
- data() {
- return {
- queryData: {
- companyId: "0",
- timeRange: this.$util.dateUtil.getNearlyMonthRange(),
- },
- companyOptions: [
- {
- label: '全部',
- value: '0'
- }
- ],
- coreData: [
- {
- title: "文印累计排放(tCO₂e)",
- num: 0,
- historyDesc: "同比",
- historyNum: 0,
- },
- {
- title: "文印人均排放(tCO₂e/天)",
- num: 0,
- historyDesc: "同比",
- historyNum: 0,
- },
- {
- title: "纸张累计排放(tCO₂e)",
- num: 0,
- historyDesc: "同比",
- historyNum: 0,
- },
- {
- title: "墨盒累计排放(tCO₂e)",
- num: 0,
- historyDesc: "同比",
- historyNum: 0,
- },
- {
- type: 1,
- title: "值得关注",
- showStar: true,
- content: "",
- },
- ],
- newsData: [
- {
- title: "xxxxxxxxxx",
- tag: "双碳小知识",
- author: "张峰",
- time: "2022-02-02 15:00:00",
- },
- ],
- };
- },
- mounted() {
- this.init();
- },
- methods: {
- init() {
- this.$store.loadingStore().loadingWithApi(this.getCoreData(), 2000);
- },
- reset() {
- },
- search(data) {
- this.$util.asyncPromise(
- this.getCoreData(),
- this.$refs.CarbonPrintEmissionChart.getData(),
- this.$refs.CarbonPrintQuotaChart.getData()
- );
- },
- getCoreData() {
- return apiCarbonPrint.getCoreData(this.queryData).then((res) => {
- this.coreData[0].num = res.list[0].value;
- this.coreData[0].historyNum = res.list[0].compare;
- this.coreData[1].num = res.list[1].value;
- this.coreData[1].historyNum = res.list[1].compare;
- this.coreData[2].num = res.list[2].value;
- this.coreData[2].historyNum = res.list[2].compare;
- this.coreData[3].num = res.list[3].value;
- this.coreData[3].historyNum = res.list[3].compare;
- this.coreData[4].content = res.worthAttention;
- });
- },
- callBackCompanyOption(options) {
- this.companyOptions = [
- {
- label: '全部',
- value: '0'
- }
- ]
- if (options) {
- options.forEach(item => {
- this.companyOptions.push(item);
- })
- }
- this.$forceUpdate()
- },
- },
- };
- </script>
- <template>
- <div class="doubleCarbon-print">
- <div class="page-query-core">
- <Query
- :show="['company', 'time']"
- :query-data.sync="queryData"
- :company-options="companyOptions"
- :reset="reset"
- :search="search"
- ></Query>
- </div>
- <div class="page-query-core">
- <Card title="核心指标">
- <CoreData :data-list="coreData"></CoreData>
- </Card>
- </div>
- <div style="margin-top: 12px">
- <a-row :gutter="[12, 12]">
- <a-col :span="18">
- <div class="ioc-card-content">
- <Card title="文印排放分析">
- <div class="doubleCarbon-print-analyse">
- <CarbonPrintEmissionChart
- ref="CarbonPrintEmissionChart"
- :query-data="queryData"
- :callBackCompanyOption="callBackCompanyOption"
- :height="450"
- />
- </div>
- </Card>
- </div>
- </a-col>
- <a-col :span="6">
- <div class="ioc-card-content">
- <Card title="文印排放排名">
- <div class="doubleCarbon-print-quota">
- <CarbonPrintQuotaChart
- ref="CarbonPrintQuotaChart"
- :query-data="queryData"
- :height="450"
- />
- </div>
- </Card>
- </div>
- </a-col>
- </a-row>
- </div>
- </div>
- </template>
- <style lang="less" scoped>
- .doubleCarbon-print {
- width: 100%;
- height: auto;
- padding-bottom: 15px;
- vertical-align: top;
- .doubleCarbon-print-analyse {
- padding: 12px;
- }
- .doubleCarbon-print-quota {
- padding: 12px;
- }
- .doubleCarbon-print-news {
- padding: 0 12px;
- height: 300px;
- }
- .doubleCarbon-print-percent {
- padding: 0 12px;
- height: 300px;
- }
- }
- </style>
|