Browse Source

根据项目显示不同的名称

zhaojijng 2 năm trước cách đây
mục cha
commit
b19e35aaf3
3 tập tin đã thay đổi với 22 bổ sung3 xóa
  1. 2 1
      src/App.vue
  2. 2 1
      src/api/second.ts
  3. 18 1
      src/store/index.ts

+ 2 - 1
src/App.vue

@@ -19,6 +19,7 @@ export default {
         this.getAirCondition(); //空调数据
         this.getLastAllEnergy(); //上月所有能耗数据  上月总能耗 上月节约能耗
         this.getWeahter(); //获取天气
+        this.getProjectData()
         window.onresize = () => {
             console.log("resize");
             this.setBodyWidth(
@@ -37,7 +38,7 @@ export default {
     components: {},
     methods: {
         ...mapMutations(["setBodyWidth", "setBodyHeight"]),
-        ...mapActions(["getAirCondition", "getLastAllEnergy", "getWeahter"]),
+        ...mapActions(["getAirCondition", "getLastAllEnergy", "getWeahter",'getProjectData']),
     },
 };
 </script>

+ 2 - 1
src/api/second.ts

@@ -8,6 +8,7 @@ export default {
         "/sgshow/duoduo-service/review-service/energy/week/day/query", //上月每日能耗
     queryLastAllEnergy:
         "/sgshow/duoduo-service/review-service/sceneValue/query", //上月所有能耗
-    saveMapInfo:"/sgshow/duoduo-service/setup-service/map/saveMapInfo"//保存地图
+    saveMapInfo:"/sgshow/duoduo-service/setup-service/map/saveMapInfo",//保存地图
+    queryProject: "/sgshow/duoduo-service/object-service/object/project/query", //获取楼层详情
         
 };

+ 18 - 1
src/store/index.ts

@@ -17,6 +17,7 @@ export default new Vuex.Store({
         bodyWidth: null,
         bodyHeight: null,
         projectId: "Pj3301100002",
+        projectObj: {},
     },
     getters: {
         getBodyWidthHeight(state) {
@@ -47,6 +48,9 @@ export default new Vuex.Store({
         getLastAllEnergy(state, data) {
             state.lastAllEnergy = data;
         },
+        getProjectObj(state, data) {
+            state.projectObj = data;
+        },
         getWeahter(state, data) {
             state.weatherCont = data;
         },
@@ -90,7 +94,19 @@ export default new Vuex.Store({
                     commit("getLastMonthData", resdata);
                 });
         },
-
+        getProjectData({ state, commit }, data) {
+            //上月数据
+            axios
+                .post(api.queryProject, {
+                    criteria: {
+                        id: state.projectId,
+                    },
+                })
+                .then((res: any) => {
+                    var project = res.data.content[0] || {};
+                    commit("getProjectObj", project);
+                });
+        },
         getLastAllEnergy({ state, commit }, data) {
             //上月所有能耗数据  上月总能耗 上月节约能耗
             var monthTime = moment().subtract(1, "month"); //往前取15分钟
@@ -110,6 +126,7 @@ export default new Vuex.Store({
                     commit("getLastAllEnergy", resdata);
                 });
         },
+
         getWeahter({ state, commit }, data) {
             axios
                 .get(api.getWeatherCurrent + `?projectId=${state.projectId}`)