zhaojijng 3 سال پیش
والد
کامیت
961fc38af8

+ 1 - 0
.gitignore

@@ -2,6 +2,7 @@
 node_modules
 /dist
 /sagadaping
+/sgshow
 
 # local env files
 .env.local

+ 5 - 0
public/config2.js

@@ -0,0 +1,5 @@
+
+var data = {
+    projectId:'Pj1101020002'
+}
+module.exports = data;

+ 18 - 14
public/index.html

@@ -1,17 +1,21 @@
 <!DOCTYPE html>
 <html lang="">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width,initial-scale=1.0">
-    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
-  </head>
-  <body>
-    <noscript>
-      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
-    </noscript>
-    <div id="app"></div>
-    <!-- built files will be auto injected -->
-  </body>
+    <head>
+        <meta charset="utf-8" />
+        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+        <meta name="viewport" content="width=device-width,initial-scale=1.0" />
+        <link rel="icon" href="<%= BASE_URL %>favicon.ico" />
+        <title><%= htmlWebpackPlugin.options.title %></title>
+    </head>
+    <body>
+        <noscript>
+            <strong
+                >We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't
+                work properly without JavaScript enabled. Please enable it to
+                continue.</strong
+            >
+        </noscript>
+        <div id="app"></div>
+        <!-- built files will be auto injected -->
+    </body>
 </html>

+ 21 - 19
src/store/index.ts

@@ -2,6 +2,7 @@ import Vue from "vue";
 import Vuex from "vuex";
 import axios from "@/utils/axios";
 import api from "@/api/index";
+const { projectId } = require("/public/config2.js");
 
 Vue.use(Vuex);
 
@@ -12,21 +13,21 @@ export default new Vuex.Store({
         lastMonthData: [], //上月数据
         lastAllEnergy: {}, //上月所有能耗数据
         weatherCont: {}, //天气
-        bodyWidth:null,
-        bodyHeight:null,
+        bodyWidth: null,
+        bodyHeight: null
     },
-    getters:{
-        getBodyWidthHeight(state){
-            return [state.bodyWidth,state.bodyHeight]
-        }
+    getters: {
+        getBodyWidthHeight(state) {
+            return [state.bodyWidth, state.bodyHeight];
+        },
     },
     mutations: {
-        setBodyWidth(state,width){
-           // debugger;
-            state.bodyWidth=width;
+        setBodyWidth(state, width) {
+            // debugger;
+            state.bodyWidth = width;
         },
-        setBodyHeight(state,height){
-            state.bodyHeight=height;
+        setBodyHeight(state, height) {
+            state.bodyHeight = height;
         },
         getRealTimeData(state, data) {
             //debugger;
@@ -47,9 +48,10 @@ export default new Vuex.Store({
     },
     actions: {
         getRealTimeData({ state, commit }, data) {
+            console.log("projectId", projectId);
             //实时数据
             axios
-                .get(api.queryEnvCurrent + "?projectId=Pj1101020002")
+                .get(api.queryEnvCurrent + `?projectId=${projectId}`)
                 .then((res: any) => {
                     //debugger
                     var resdata = res.data.data || [];
@@ -59,7 +61,7 @@ export default new Vuex.Store({
         getAirCondition({ state, commit }, data) {
             //空调状态
             axios
-                .get(api.queryConditionerStatus + "?projectId=Pj1101020002")
+                .get(api.queryConditionerStatus + `?projectId=${projectId}`)
                 .then((res: any) => {
                     var resdata = res.data.data || {};
                     // debugger;
@@ -69,13 +71,13 @@ export default new Vuex.Store({
         getRealTimeTemp({ state, commit }, data) {
             //实时温度
             return axios.get(
-                api.queryIndoorTempList + "?projectId=Pj1101020002"
+                api.queryIndoorTempList + `?projectId=${projectId}`
             );
         },
         getLastMonthData({ state, commit }, data) {
             //上月数据
             axios
-                .get(api.queryEnvHistory + "?projectId=Pj1101020002")
+                .get(api.queryEnvHistory + `?projectId=${projectId}`)
                 .then((res: any) => {
                     //debugger;
                     var resdata = res.data.data || [];
@@ -88,23 +90,23 @@ export default new Vuex.Store({
             axios
                 .post(api.queryLastAllEnergy, {
                     criteria: {
-                        projectId: "Pj1101080259",
+                        projectId: projectId,
                     },
                 })
                 .then((res: any) => {
                     // debugger;
-                    
+
                     var resdata = res.data.content[0] || {};
                     commit("getLastAllEnergy", resdata);
                 });
         },
         getWeahter({ state, commit }, data) {
             axios
-                .get(api.getWeatherCurrent + "?projectId=Pj1101020002")
+                .get(api.getWeatherCurrent + `?projectId=${projectId}`)
                 .then((res: any) => {
                     //temperature = res.data.content.temperature;
                     //debugger;
-                    var weatherCont = res.data.content||{};
+                    var weatherCont = res.data.content || {};
                     commit("getWeahter", weatherCont);
                 });
         },

+ 2 - 0
src/views/horizontalScreen.vue

@@ -98,6 +98,8 @@ export default {
     },
     mounted() {
         this.nowPage = 1;
+       // debugger;
+        
         this.timePageShow();
     },
     methods: {

+ 4 - 3
src/views/valueDelivery/FloorSpace.vue

@@ -66,6 +66,7 @@
 import { Loading } from "element-ui";
 import moment from "moment";
 import { selectColor } from "@/utils/publicMethod";
+const { projectId } = require("/public/config2.js");
 
 export default {
     name: "FloorSpace",
@@ -182,7 +183,7 @@ export default {
             this.$axios
                 .post(this.$api.queryFs, {
                     criteria: {
-                        projectId: "Pj1101020002",
+                        projectId: projectId,
                     },
                     size: 14, //最多14层
                     page: 1,
@@ -223,7 +224,7 @@ export default {
                     this.firstPageParams = firstPageFloors.map((item) => {
                         var obj = {};
                         obj.id = item.id;
-                        obj.projectId = "Pj1101020002";
+                        obj.projectId = projectId;
                         obj.spaceNum = firstMaxSpace;
                         return obj;
                     });
@@ -231,7 +232,7 @@ export default {
                     this.secondPageParams = secondPageFloors.map((item) => {
                         var obj = {};
                         obj.id = item.id;
-                        obj.projectId = "Pj1101020002";
+                        obj.projectId = projectId;
                         obj.spaceNum = sendMaxSpace;
                         return obj;
                     });

+ 4 - 3
src/views/valueDelivery/HorFloorSpace.vue

@@ -47,6 +47,7 @@
 <script>
 import moment from "moment";
 import { selectColor } from "@/utils/publicMethod";
+const { projectId } = require("/public/config2.js");
 
 export default {
     name: 'FloorSpace',
@@ -168,7 +169,7 @@ export default {
             this.$axios
                 .post(this.$api.queryFs, {
                     criteria: {
-                        projectId: "Pj1101020002",
+                        projectId: projectId,
                     },
                     size: 14,//最多14层
                     page: 1,
@@ -208,7 +209,7 @@ export default {
                     this.firstPageParams = firstPageFloors.map((item) => {
                         var obj = {};
                         obj.id = item.id;
-                        obj.projectId = "Pj1101020002";
+                        obj.projectId = projectId;
                         obj.spaceNum = firstMaxSpace;//最多空间数
                         return obj;
                     });
@@ -216,7 +217,7 @@ export default {
                     this.secondPageParams = secondPageFloors.map((item) => {
                         var obj = {};
                         obj.id = item.id;
-                        obj.projectId = "Pj1101020002";
+                        obj.projectId = projectId;
                         obj.spaceNum = sendMaxSpace;
                         return obj;
                     });

+ 2 - 1
src/views/valueDelivery/lastEnergyChart.vue

@@ -19,6 +19,7 @@ import G2 from "@antv/g2";
 import DataSet from "@antv/data-set";
 import moment from "moment";
 import { mapGetters } from "vuex";
+const { projectId } = require("/public/config2.js");
 
 // 自定义 shape, 支持图片形式的气泡
 G2.Shape.registerShape("interval", "borderRadius", {
@@ -115,7 +116,7 @@ export default {
             this.$axios
                 .post(this.$api.queryLastDayEnergy, {
                     criteria: {
-                        projectId: "Pj1101080259",
+                        projectId: projectId,
                         date: {
                             $gte: start,
                             $lte: end,

+ 4 - 1
vue.config.js

@@ -1,7 +1,10 @@
 const { name } = require("./package.json");
+const { projectId } = require("./public/config2.js");
+
 let env = process.env.NODE_ENV.toString();
 console.log('env2', env);
-
+console.log('env2--name', name);
+console.log('env2---projectId', projectId);
 module.exports = {
     publicPath: '/sgshow', //相对路径
     outputDir: 'sgshow', //打包名称