Browse Source

添加切换路由取消上个路由未响应的接口,二轮测试bug修改

zhangyu 3 years ago
parent
commit
f491de364c

+ 5 - 0
src/api/httputils.js

@@ -19,6 +19,11 @@ const axiosservice = axios.create({
 
 axiosservice.interceptors.request.use(
     config => {
+        config.cancelToken = new axios.CancelToken(cancel => {
+            if (config.url !== '/api/message-center/message/update-state' || config.url !== '/image-service/common/multipart_upload') {
+                store.commit('setAxiosArr', {cancel})
+            }
+        })
         config.withCredentials = true // 允许携带token ,这个是解决跨域产生的相关问题
         let token = store.getters['ssoToken']
         if (token) {

+ 6 - 0
src/api/scan/fetch.js

@@ -1,6 +1,7 @@
 import Vue from 'vue'
 import axios from 'axios'
 import vueAxios from 'vue-axios'
+import store from '@/store'
 import { Message } from 'element-ui';
 
 Vue.use(vueAxios, axios)
@@ -13,6 +14,11 @@ const service = axios.create({
 
 //request拦截
 service.interceptors.request.use(config => {
+    config.cancelToken = new axios.CancelToken(cancel => {
+        if (config.url !== '/api/message-center/message/update-state' || config.url !== '/image-service/common/multipart_upload') {
+            store.commit('setAxiosArr', {cancel})
+        }
+    })
   return config
 }, error => {
   console.log(error)

+ 2 - 0
src/api/scan/httpUtil.js

@@ -22,6 +22,8 @@ function successResponse(vm, response, success, failed) {
 
 function errorResponse(vm, response, err) {
   let json = JSON.parse(JSON.stringify(response))
+  if (json.message === '路由调整取消请求')
+  return 
   console.error(response)
   if (json.response) {
     Message.error({ message: `接口:${json.response.config.url}请求错误,错误状态为:${json.response.status}` })

+ 4 - 0
src/components/business_space/business/handsontable.vue

@@ -311,6 +311,10 @@ export default {
     initHot() {
       var container = document.getElementById(this.id);
       let winHeight = document.documentElement.clientHeight;
+      if (this.hot) {
+        this.hot.destroy();
+        this.hot = null;
+      }
       this.hot = new Handsontable(container, {
         data: this.main,
         colHeaders: this.delHeader(this.headers), //表头文案

+ 1 - 1
src/components/dialogs/list/systemType.vue

@@ -140,7 +140,7 @@ export default {
                         localName: "全部"
                     }, {
                         id: "noKnow",
-                        localName: "未明确建筑的设备"
+                        localName: "未明确建筑的系统"
                     })
                     this.options = data
                 } else {

+ 1 - 0
src/components/relation/relationShip/Modal/addRelationShip.vue

@@ -62,6 +62,7 @@
             </p>
             <el-form-item
               v-for="(item,index) in ruleForm.codeList"
+              style="margin-bottom: 26px;"
               :key="index"
               :prop="`codeList.${index}.value`"
               :rules="rules.codeList"

+ 1 - 1
src/framework/layout/Main.vue

@@ -18,7 +18,7 @@
           <router-view v-if='$route.meta.keepAlive' class='page-content'></router-view>
         </keep-alive>
         <router-view v-if='!$route.meta.keepAlive' class='page-content'></router-view>
-        <div class="version">当前版本: V 4.0.1</div>
+        <div class="version">当前版本: V 3.9.10</div>
       </div>
     </div>
     <!-- <div class='page-footer'>

+ 1 - 1
src/framework/layout/layout-store.js

@@ -26,7 +26,7 @@ export default {
     },
     projectId: '',
     group_code: '',
-    projects: project["39"],
+    projects: project["14"],
     breadcrumb: [],
     uploaderList: [], //当前上传文件列表
     secret: "saga123456", //项目密码

+ 20 - 1
src/store/index.js

@@ -10,6 +10,7 @@ const KEY_LAST_ROUTE = 'last_route'
 export default new Vuex.Store({
   state: {
     flag: 'sagacloud-admin',
+    axiosArr: [],
     ssoToken: null,
     lastRoute: null
   },
@@ -31,9 +32,27 @@ export default new Vuex.Store({
     setLastRoute: (state, val) => {
       state.lastRoute = val
       storage.set(KEY_LAST_ROUTE, val)
+    },
+    setAxiosArr: ({axiosArr}, cancelAjax) => {
+        axiosArr.push(cancelAjax.cancel);
+    },
+    clearAxiosArr: ({axiosArr}) => {
+        axiosArr.forEach(item => {
+            let message = '路由调整取消请求';
+            item(message);
+        })
     }
   },
-  actions: {},
+  actions: {
+      setAxiosArr: ({ commit }, cancelAjax) => {
+        console.log("setAxiosArr");
+        commit('SET_AXIOS_ARR', cancelAjax);
+      },
+      clearAxiosArr: ({ commit }) => {
+          console.log("clearAxiosArr");
+          commit('CLEAR_AXIOS_ARR');
+      }
+  },
   modules: {
     layout,
     project,

+ 1 - 0
src/utils/authutils.js

@@ -40,6 +40,7 @@ export default {
    */
   routerBeforeEach: async function (to, from, next) {
     console.log('router before ', to)
+    store.commit('clearAxiosArr')
     if (to.path == '/auth' || to.path == '/nouser') {
       next()
     } else {

+ 8 - 8
src/views/data_admin/buildAssets/index.vue

@@ -106,7 +106,6 @@ export default {
   methods: {
     ...mapActions('layout', ['setErrorReport']),
     handleTime(val) {
-      console.log(val)
       let param = {
         filters: `createTime > '${val[0]}';createTime < '${val[1]}'`,
         pageNumber: 1,
@@ -198,18 +197,19 @@ export default {
         }
       })
     },
-    async init() {
-      await this.getAllFamily();
-      await this.getFloors();
-      await this.getBuilding()
-    }
+    // async init() {
+    //   await this.getAllFamily();
+    //   await this.getFloors();
+    //   await this.getBuilding()
+    // }
   },
   created() {
-    this.init()
+    // this.init()
   },
   watch: {
     projectId() {
-      this.init()
+        this.value = "";
+    //   this.init()
     }
   }
 }

+ 74 - 67
src/views/ledger/report/index.vue

@@ -142,7 +142,7 @@ import {
   systemInfoPoint,
   gatherInfoPoint
 } from "@/api/scan/request";
-import { getDataDictionary } from "@/api/dict";
+import { getDataDictionary, queryPhysicsAllType } from "@/api/dict";
 import dataOrigin from "@/components/ledger/report/dataorigin";
 import datafan from "@/components/ledger/report/datafan";
 import dataExport from "@/components/ledger/report/dataexport";
@@ -162,71 +162,71 @@ export default {
       partsCount: null,// 部件总数
       zoneSpaceCount: null,// 业务空间总数
       zoneType: [// 分区类型
-        {
-          "code": "GeneralZone",
-          "name": "默认分区",
-          "Rel_type": "99"
-        },
-        {
-          "name": "供电分区",
-          "Rel_type": "1",
-          "code": "PowerSupplyZone"
-        },
-        {
-          "name": "照明分区",
-          "Rel_type": "2",
-          "code": "LightingZone"
-        },
-        {
-          "name": "网络分区",
-          "Rel_type": "3",
-          "code": "NetworkZone"
-        },
-        {
-          "code": "AirConditioningZone",
-          "name": "空调分区",
-          "Rel_type": "4"
-        },
-        {
-          "name": "采暖分区",
-          "Rel_type": "5",
-          "code": "HeatingZone"
-        },
-        {
-          "name": "洁净分区",
-          "Rel_type": "6",
-          "code": "CleanZone"
-        },
-        {
-          "name": "生活给水分区",
-          "Rel_type": "7",
-          "code": "DomesticWaterSupplyZone"
-        },
-        {
-          "code": "FireZone",
-          "name": "防火分区",
-          "Rel_type": "8"
-        },
-        {
-          "name": "安防分区",
-          "Rel_type": "9",
-          "code": "SecurityZone"
-        },
-        {
-          "name": "租户分区",
-          "Rel_type": "10",
-          "code": "TenantZone"
-        },
-        {
-          "name": '功能分区',
-          'Rel_type': '11',
-          "code": 'FunctionZone'
-        },
-        {
-          "name": '其他分区',
-          'Rel_type': '11',
-          "code": 'OtherZone'
-        }
+        // {
+        //   "code": "GeneralZone",
+        //   "name": "默认分区",
+        //   "Rel_type": "99"
+        // },
+        // {
+        //   "name": "供电分区",
+        //   "Rel_type": "1",
+        //   "code": "PowerSupplyZone"
+        // },
+        // {
+        //   "name": "照明分区",
+        //   "Rel_type": "2",
+        //   "code": "LightingZone"
+        // },
+        // {
+        //   "name": "网络分区",
+        //   "Rel_type": "3",
+        //   "code": "NetworkZone"
+        // },
+        // {
+        //   "code": "AirConditioningZone",
+        //   "name": "空调分区",
+        //   "Rel_type": "4"
+        // },
+        // {
+        //   "name": "采暖分区",
+        //   "Rel_type": "5",
+        //   "code": "HeatingZone"
+        // },
+        // {
+        //   "name": "洁净分区",
+        //   "Rel_type": "6",
+        //   "code": "CleanZone"
+        // },
+        // {
+        //   "name": "生活给水分区",
+        //   "Rel_type": "7",
+        //   "code": "DomesticWaterSupplyZone"
+        // },
+        // {
+        //   "code": "FireZone",
+        //   "name": "防火分区",
+        //   "Rel_type": "8"
+        // },
+        // {
+        //   "name": "安防分区",
+        //   "Rel_type": "9",
+        //   "code": "SecurityZone"
+        // },
+        // {
+        //   "name": "租户分区",
+        //   "Rel_type": "10",
+        //   "code": "TenantZone"
+        // },
+        // {
+        //   "name": '功能分区',
+        //   'Rel_type': '11',
+        //   "code": 'FunctionZone'
+        // },
+        // {
+        //   "name": '其他分区',
+        //   'Rel_type': '11',
+        //   "code": 'OtherZone'
+        // }
       ],
       partProtion: [],// 业务空间-各分区占比数据
       defaultPart: [],// 业务空间-默认分区功能类型占比数据
@@ -640,6 +640,7 @@ export default {
       })
     },
     getZoneSpaceCount() {// 获取业务空间数据
+        this.zoneType = [];
       // 获取业务空间总数
       queryZoneCount(this.params, res => {
         this.zoneSpaceCount = res.count;
@@ -654,12 +655,18 @@ export default {
           resolve(res)
         })
       })
-      Promise.all([promise1, promise2]).then(response => {
+      let promise3 = new Promise((resolve) => {
+        queryPhysicsAllType({type: 'space', projectId: this.projectId}, res => {
+          resolve(res)
+        })
+      })
+      Promise.all([promise1, promise2, promise3]).then(response => {
         this.business = [];
         this.partProtion = [];
         this.defaultPart = [];
         let res1 = response[0]
         let res2 = response[1]
+        this.zoneType = response[2].content
         if (res1.content.length) {
           res1.content.forEach(item => {
             this.zoneTypeConversion(item);