Parcourir la source

空调节能接口

Shannon_mu il y a 1 an
Parent
commit
a13889f5e7

+ 115 - 0
energyManagement/src/views/refrigeration/energyEfficiencyAnalysis/index.vue

@@ -0,0 +1,115 @@
+<template>
+    <div class="main">
+        <div class="search">
+            <el-input placeholder="输入项目名称" class="search-input" clearable v-model="mixins_query.deviceNo"></el-input>
+            <el-date-picker
+                v-model="times"
+                value-format="yyyyMM"
+                type="monthrange"
+                range-separator="至"
+                start-placeholder="选择开始月份"
+                end-placeholder="选择结束月份"
+                @change="effectiveDateToggle"
+            ></el-date-picker>
+            <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
+            <div class="search-icon">
+                <el-tooltip class="item" effect="light" placement="bottom" content="导出">
+                    <i class="zoniot_font zoniot-icon-daochu2" @click="exportExcel"></i>
+                </el-tooltip>
+
+                <el-dropdown type="primary" @command="addCommand">
+                    <span class=" zoniot_font zoniot-icon-tianjia2"></span>
+                    <el-dropdown-menu slot="dropdown" hide-on-click="false" class="device-search-dropdown">
+                        <el-dropdown-item command="batchAdd">
+                            <div class="upload_div">
+                                <xk-upload class="upload_class" @callback="mixins_search" :params="{ importType: 'WATER' }">
+                                    <span class="upload_text" slot="content">批量添加</span>
+                                </xk-upload>
+                            </div>
+                        </el-dropdown-item>
+                        <el-dropdown-item command="template">下载模板</el-dropdown-item>
+                    </el-dropdown-menu>
+                </el-dropdown>
+            </div>
+        </div>
+        <div class="roles-wrap">
+            <zz-table
+                :cols="cols"
+                :settings="{ showIndex: true, stripe: true }"
+                :loading="mixins_onQuery"
+                :data="mixins_list"
+                :pageset="mixins_pageset"
+                @page-change="pageChange"
+            >
+            </zz-table>
+        </div>
+    </div>
+</template>
+
+<script>
+import list from '@utils/list.js';
+export default {
+    mixins: [list],
+    data() {
+        return {
+            times: [],
+            cols: [
+                {
+                    label: '项目名称',
+                    prop: 'projectName'
+                },
+                {
+                    label: '年份',
+                    prop: 'year'
+                },
+                {
+                    label: '月份',
+                    prop: 'month'
+                },
+                {
+                    label: '用电量(kw.h)',
+                    prop: 'powerConsumption'
+                },
+                {
+                    label: '制冷量(kw)',
+                    prop: 'refrigerationCapacity'
+                },
+                {
+                    label: '基准用电量(kw.h)',
+                    prop: 'standardPowerConsumption'
+                },
+            ],
+            mixins_post: 'get'
+        };
+    },
+    created() {
+        this.mixins_dataUrl = '/sc-energy/projectData/getPage';
+        this.mixins_search();
+    },
+    mounted() {},
+    methods: {
+        addCommand(command) {
+            if (command === 'template') {
+                this.__exportExcel('/sc-energy/projectData/downTemplate');
+                return;
+            }
+        },
+        effectiveDateToggle(va) {
+            let arr = va;
+            if (!arr) {
+                arr = ['', ''];
+            }
+            this.mixins_query.startDate = arr[0];
+            this.mixins_query.endDate = arr[1];
+        },
+        exportExcel() {
+            this.__exportExcel('/sc-energy/projectData/export/excel', this.mixins_query);
+        },
+    }
+};
+</script>
+<style lang="scss" scoped>
+.zoniot_font{
+    font-size: 30px;
+}
+</style>

+ 12 - 2
energyManagement/src/views/refrigeration/energySavingPlatform/dataOverView.vue

@@ -63,9 +63,19 @@ export default {
         };
     },
 
-    mounted() {},
+    mounted() {this.getdata()},
 
-    methods: {}
+    methods: {
+        getdata(){
+            this.$http.get('/sc-energy/board/getProjectDataInfo').then(({data})=>{
+                this.list[0].value = data.powerConsumption;
+                this.list[1].value = data.refrigerationCapacity;
+                this.list[2].value = data.powerSaving;
+                this.list[3].value = data.carbonSaving;
+                this.list[4].value = data.utilities;
+            })
+        }
+    }
 };
 </script>
 

+ 43 - 12
energyManagement/src/views/refrigeration/energySavingPlatform/energyAnalyze.vue

@@ -2,7 +2,7 @@
     <div class="any-wrap">
         <Label :label="label" :icon="icon" />
         <div class="chart-wrap">
-            <zz-echart :option="options" class="chart"></zz-echart>
+            <zz-echart :option="options" class="chart" ref="charts"></zz-echart>
         </div>
     </div>
 </template>
@@ -103,18 +103,20 @@ export default {
     },
 
     created() {
-        this.setData();
+        this.getData();
     },
 
     mounted() {
-        let that = this;
-        window.addEventListener('resize', function () {
-            that.setData();
-        });
+        window.addEventListener('resize', ()=>{
+            if(this.$refs.charts){
+                this.$refs.charts.echart.resize();
+            }
+        })
     },
 
     methods: {
-        setData() {
+        setData({data,standardCop,month}) {
+            this.options.xAxis[0].data = month;
             if (this.type == 1) {
                 this.label = '月度能效趋势';
                 this.icon = require('../../../assets/img/energyIcon/icon_erey.png');
@@ -136,13 +138,13 @@ export default {
                             }
                         },
                         symbol: 'none',
-                        data: [4.28, 4.36, 4.69, 5.0, 4.88, 4.5, 4.6, 4.8],
+                        data: data,
                         markLine: {
                             symbol: 'none',
                             data: [
                                 {
                                     name: '基准值',
-                                    yAxis: 3.15,
+                                    yAxis: standardCop,
                                     lineStyle: {
                                         color: '#27EA83'
                                     }
@@ -165,7 +167,7 @@ export default {
             } else if (this.type == '2') {
                 this.label = '月度电量分析';
                 this.icon = require('../../../assets/img/energyIcon/icon_dianliang.png');
-                this.options.legend.data = ['用电量', '基准用电量'];
+                this.options.legend.data = ['用电量', '基准用电量'];   
                 this.options.series = [
                     {
                         name: '用电量',
@@ -182,7 +184,7 @@ export default {
                                 return value + ' kw.h';
                             }
                         },
-                        data: [14118, 31750, 55630, 92420, 104200, 108420, 93800, 98600]
+                        data: data[0]
                     },
                     {
                         type: 'line',
@@ -194,10 +196,39 @@ export default {
                         itemStyle: {
                             color: '#FF9E21'
                         },
-                        data: [18824, 45357, 79471, 128361, 157870, 180700, 148888, 159032]
+                        data: data[1]
                     }
                 ];
             }
+        },
+        getData(){
+            if (this.type == 1) {
+
+                let month = [],cop=[],standardCop=0;
+                this.$http.get('/sc-energy/board/getMonthlyEnergyTendency').then(({data})=>{
+                    data.map(item=>{
+                        month.push(item.month);
+                        cop.push(item.cop);
+                        standardCop = item.standardCop
+                    })
+                    this.setData({data:cop,standardCop:standardCop,month:month})
+                }).catch(() => { });
+
+            }else if (this.type == 2) {
+ 
+                let month = [],powerConsumption=[],standardPowerConsumption=[]; 
+                this.$http.get('/sc-energy/board/getMonthlyElectricalAnalysis').then(({data})=>{
+                    data.map(item=>{
+                        month.push(item.month);
+                        powerConsumption.push(item.powerConsumption);
+                        standardPowerConsumption.push(item.standardPowerConsumption)
+                    })
+                    this.setData({data:[powerConsumption,standardPowerConsumption],month:month})
+                }).catch(() => { });
+                
+            }
+   
+            
         }
     }
 };

+ 13 - 1
energyManagement/src/views/refrigeration/energySavingPlatform/projectSummary.vue

@@ -73,7 +73,9 @@ export default {
         };
     },
 
-    mounted() {},
+    mounted() {
+        this.getdata()
+    },
 
     methods: {
         getTime() {
@@ -81,6 +83,16 @@ export default {
             let weeks = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六']
             let week = weeks[date.getDay()]
             return this.$moment(date).format('YYYY-MM-DD') + ' ' + week   
+        },
+        getdata(){
+            this.$http.get('/sc-energy/board/getProjectInfo').then(({data})=>{
+                this.list[0].value = data.area;
+                this.list[1].value = data.installedCapacity;
+                this.list[2].value = data.refrigerationCapacity;
+                this.list[3].value = data.totalPower;
+                this.list[4].value = data.environmentTemperature;
+                this.list[5].value = data.indoorTemperature;
+            })
         }
     }
 };

+ 152 - 0
energyManagement/src/views/refrigeration/projectInformation/index.vue

@@ -0,0 +1,152 @@
+<template>
+    <div class="main">
+        <div class="search">
+            <el-input placeholder="输入项目名称" class="search-input" clearable v-model="mixins_query.projectName"></el-input>
+            <el-button type="primary" class="search-btn" @click="mixins_search" icon="el-icon-search">查询 </el-button>
+            <div class="search-icon">
+                <el-tooltip class="item" effect="light" placement="bottom" content="添加">
+                    <i class="zoniot_font zoniot-icon-tianjia2" @click="addOrEdit('add')"></i>
+                </el-tooltip>
+            </div>
+        </div>
+        <div class="roles-wrap">
+            <zz-table
+                :cols="cols"
+                :settings="{ showIndex: true, stripe: true }"
+                :loading="mixins_onQuery"
+                :data="mixins_list"
+                :pageset="mixins_pageset"
+                @page-change="pageChange"
+            >
+            <template slot-scope="scope" slot="opt">
+                    <div class="opt">
+                        <el-tooltip class="item" effect="light" placement="bottom" content="启用" v-if="scope.row.status!==1">
+                            <i class="zoniot_font zoniot-icon-qiyong1" @click="opens(scope.row)"></i>
+                        </el-tooltip>
+                        <el-tooltip effect="light" placement="bottom" content="编辑">
+                            <i class="zoniot_font zoniot-icon-bianji" @click="addOrEdit('edit', scope.row)"></i>
+                        </el-tooltip>
+                        <el-tooltip effect="light" placement="bottom" content="删除">
+                            <i class="zoniot_font zoniot-icon-shanchu redText" @click="delRow(scope.row)"></i>
+                        </el-tooltip>
+                    </div>
+                </template>
+            </zz-table>
+        </div>
+    </div>
+</template>
+
+<script>
+import list from '@utils/list.js';
+export default {
+    mixins: [list],
+    data() {
+        return {
+            cols: [
+                {
+                    label: '项目名称',
+                    prop: 'projectName'
+                },
+                {
+                    label: '基准COP',
+                    prop: 'standardCop'
+                },
+                {
+                    label: '装机数量(台)',
+                    prop: 'installedCapacity'
+                },
+                {
+                    label: '装机总制冷量(kw)',
+                    prop: 'refrigerationCapacity'
+                },
+                {
+                    label: '总装机功率(kw)',
+                    prop: 'totalPower'
+                },
+                {
+                    label: '环境温度(℃)',
+                    prop: 'environmentTemperature'
+                },
+                {
+                    label: '操作',
+                    prop: 'id',
+                    slot: 'opt'
+                }
+            ],
+            mixins_post: 'get'
+        };
+    },
+    created() {
+        this.mixins_dataUrl = '/sc-energy/project/getPage';
+        this.mixins_search();
+    },
+    mounted() {},
+    methods: {
+        delRow(rowinfo) {
+            const { id } = rowinfo;
+            this.$msgBox(`该项目的所有数据将被删除,删除后将无法恢复,是否继续?`,'删除项目数据')
+                .then(() => {
+                    const $loading = this.$loading();
+                    this.$http
+                        .postForm(`/sc-energy/project/delete`,{id:id})
+                        .then(({ status, msg }) => {
+                            $loading.close();
+                            if (status == 0) {
+                                this.mixins_search();
+                                this.$message.success(msg);
+                            } else {
+                                this.$message.error(msg);
+                            }
+                        })
+                        .catch(() => {
+                            $loading.close();
+                        });
+                })
+                .catch(() => {});
+        },
+        opens(rowinfo) {
+            const { id } = rowinfo;
+            this.$msgBox(`该模板使用后,数据看板数据将会发生改变,是否继续?`,'确认使用该模板')
+                .then(() => {
+                    const $loading = this.$loading();
+                    this.$http
+                        .postForm(`/sc-energy/project/enable`,{id:id})
+                        .then(({ status, msg }) => {
+                            $loading.close();
+                            if (status == 0) {
+                                this.mixins_search();
+                                this.$message.success(msg);
+                            } else {
+                                this.$message.error(msg);
+                            }
+                        })
+                        .catch(() => {
+                            $loading.close();
+                        });
+                })
+                .catch(() => {});
+        },
+        addOrEdit(todo, data = {}) {
+            new Promise((resolve) => {
+                let title = '添加项目';
+                if (todo !== 'add') {
+                    title = '修改项目';
+                }
+                this.$store.dispatch('addPopup', {
+                    url: '/refrigeration/projectInformation/popups/addEdit.vue',
+                    width: '500px',
+                    height: '600px',
+                    props: {
+                        data,
+                        todo,
+                        callback: resolve
+                    },
+                    title: title
+                });
+            }).then(() => {
+                this.mixins_search();
+            });
+        }
+    }
+};
+</script>

+ 196 - 0
energyManagement/src/views/refrigeration/projectInformation/popups/addEdit.vue

@@ -0,0 +1,196 @@
+<template>
+    <div class="alert-body__main_content">
+        <zz-form :cols="formCols" :data="formData" :rules="formRules" :errors="formErrors" labelWidth="150" ref="form">
+            <div slot="picture" class="clickUpload">
+                        <div class="clickUpText">
+                            <img class="dataImg" v-if="!!formData.picture" :src="formData.picture" />
+                            <template v-else>
+                                <div class="addImg"><i class="el-icon-plus"></i></div>
+                            </template>
+                        </div>
+                        <el-upload
+                            :headers="token"
+                            ref="uploadImg"
+                            limit="1"
+                            action="/sc-community/upload/uploadFile"
+                            :on-success="uploadsuccess"
+                            :before-upload="beforeAvatarUpload"
+                            :auto-upload="true"
+                            name="file"
+                        >
+                        </el-upload>
+                    </div>
+        </zz-form>
+    </div>
+</template>
+<script>
+export default {
+    props: ['params'],
+    data() {
+        return {
+            formData: {
+                area:"",
+                environmentTemperature:"",
+                indoorTemperature:"",
+                installedCapacity:"",
+                picture:"",
+                projectName:"",
+                refrigerationCapacity:"",
+                standardCop:"",
+                totalPower:""
+            },
+            formCols: [
+                [
+                    {
+                        label: '项目名称',
+                        prop: 'projectName',
+                        input: true
+                    },
+                    {
+                        label: '项目图片',
+                        prop: 'picture',
+                        slot: 'picture'
+                    },
+                    {
+                        label: '管控面积(㎡)',
+                        prop: 'area',
+                        input: true
+                    },
+                    {
+                        label: '基准COP',
+                        prop: 'standardCop',
+                        input: true
+                    },
+                    {
+                        label: '装机数量(台)',
+                        prop: 'installedCapacity',
+                        input: true
+                    },
+                    {
+                        label: '装机总制冷量(kw)',
+                        prop: 'refrigerationCapacity',
+                        input: true
+                    },
+                    {
+                        label: '总装机功率(kw)',
+                        prop: 'totalPower',
+                        input: true
+                    },
+                    {
+                        label: '环境温度(℃)',
+                        prop: 'environmentTemperature',
+                        input: true
+                    },
+                    {
+                        label: '室内平均温度(℃)',
+                        prop: 'indoorTemperature',
+                        input: true
+                    },
+                ]
+            ],
+            formRules: {
+                area: [this.$valid.inputRequired('管控面积')],
+                environmentTemperature: [this.$valid.inputRequired('环境温度')],
+                indoorTemperature: [this.$valid.inputRequired('室内平均温度')],
+                installedCapacity: [this.$valid.inputRequired('装机数量')],
+                picture: [this.$valid.inputRequired('项目图片')],
+                projectName: [this.$valid.inputRequired('项目名称')],
+                refrigerationCapacity: [this.$valid.inputRequired('装机总制冷量')],
+                standardCop: [this.$valid.inputRequired('基准COP')],
+                totalPower: [this.$valid.inputRequired('总装机功率')]
+            },
+            token: {
+                [localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
+            },
+            formErrors: {},
+        };
+    },
+    methods: {
+        uploadsuccess(response, file, fileList) {
+            this.$refs.uploadImg.clearFiles();
+            if (0 === response.status) {
+                this.formData.picture = response.data;
+            }
+        },
+        beforeAvatarUpload(file) {
+            // const isJPG = file.type === 'image/jpeg';
+            const isLt2M = file.size / 1024 / 1024 < 2;
+
+            // if (!isJPG) {
+            //     this.$message.error('上传头像图片只能是 JPG 格式!');
+            // }
+            if (!isLt2M) {
+                this.$message.error('上传头像图片大小不能超过 2MB!');
+            }
+            return isLt2M;
+        },
+        submit() {
+            new Promise((resolve) => {
+                this.$refs.form.validate(resolve);
+            }).then(() => {
+                var loading = this.$loading();
+                let url = '/sc-energy/project/add';
+                if (this.params.todo == 'edit') {
+                    url = '/sc-energy/project/edit';
+                }
+                this.$http
+                    .post(url, this.formData)
+                    .then(({ status, msg }) => {
+                        if (status == 0) {
+                            this.$message.success(msg);
+                            this.params.callback();
+                            this.$emit('close');
+                        }
+                        loading.close();
+                    })
+                    .catch(() => {
+                        loading.close();
+                    });
+            });
+        }
+    },
+    created() {
+        if (this.params.todo == 'edit') {
+            this.formData = this.params.data;
+        }
+    }
+};
+</script>
+<style lang="scss" scoped>
+.clickUpload {
+    width: 72px;
+    height: 72px;
+    border-radius: 4px;
+    border: 1px solid #e0e1e3;
+    position: relative;
+    z-index: 1000;
+    text-align: center;
+    overflow: hidden;
+    font-size: 12px;
+    cursor: pointer;
+    color: #d8d8d8;
+    .mini-upload {
+        position: absolute;
+        z-index: 0;
+    }
+}
+.clickUpText {
+    height: 100%;
+    width: 100%;
+    pointer-events: none;
+    position: absolute;
+    background: white;
+    z-index: 1;
+    img.dataImg {
+        width: 100%;
+        height: 100%;
+        object-fit: cover;
+    }
+    .addImg {
+        line-height: 72px;
+        & > i {
+            font-size: 30px;
+        }
+    }
+}
+</style>