Browse Source

添加请求头参数

zhangyu 3 years ago
parent
commit
038704f369
2 changed files with 7 additions and 12 deletions
  1. 6 6
      src/api/scan/httpUtil.js
  2. 1 6
      src/views/ready/buildfloor/index.vue

+ 6 - 6
src/api/scan/httpUtil.js

@@ -53,14 +53,14 @@ function downFile(blob, fileName) {
 export default {
   getJson: function (url, data, success, failed, err) {
     let ProjectId = store.state.layout.projectId ? store.state.layout.projectId : localStorage.getItem("projectId");
-    let userName = storage.get("user_name")
-    let group_code = localStorage.getItem("group_code")
+    let userName = store.state.layout.userInfo.userName ? store.state.layout.userInfo.userName : storage.get("user_name");
+    let group_code = store.state.layout.group_code ? store.state.layout.group_code : localStorage.getItem("group_code");
     let vm = this;
     fetch({
       url: url,
       method: 'get',
       params: data,
-      headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName, 'group_code': group_code}
+      headers: {'projectId': ProjectId, 'appId': 'adm', 'userId': userName, 'groupCode': group_code}
     }).then((response) => {
       successResponse(vm, response, success, failed)
     }).catch(error => {
@@ -69,15 +69,15 @@ export default {
   },
   postJson: function (url, data, success, failed, err) {
     let ProjectId = store.state.layout.projectId ? store.state.layout.projectId : localStorage.getItem("projectId");
-    let userName = storage.get("user_name")
-    let group_code = localStorage.getItem("group_code")
+    let userName = store.state.layout.userInfo.userName ? store.state.layout.userInfo.userName : storage.get("user_name");
+    let group_code = store.state.layout.group_code ? store.state.layout.group_code : localStorage.getItem("group_code");
 
     let vm = this;
     fetch({
       url: url,
       method: 'post',
       data: data,
-      headers: {'ProjectId': ProjectId, 'Comming': 'adm', 'Account': userName, 'group_code': group_code}
+      headers: {'projectId': ProjectId, 'appId': 'adm', 'userId': userName, 'groupCode': group_code}
     }).then((response) => {
       successResponse(vm, response, success, failed)
     }).catch(error => {

+ 1 - 6
src/views/ready/buildfloor/index.vue

@@ -85,7 +85,7 @@
       <div>确定要删除该{{ delText }}?</div>
       <span class="dialog-footer" slot="footer">
         <el-button @click="delDialogVis=false" size="small">取消</el-button>
-        <el-button @click="confirmDel" size="small" type="primary" :disabled="buildDisabled">确认</el-button>
+        <el-button @click="confirmDel" size="small" type="primary">确认</el-button>
       </span>
     </el-dialog>
     <!-- 添加贯通关系弹窗 -->
@@ -124,7 +124,6 @@ export default {
       floorTitle: "添加楼层",
       buildTitle: "添加建筑",
       delDialogVis: false,
-      buildDisabled: false,
       delText: "建筑",
       headerStyle: {
         backgroundColor: "#d9d9d9",
@@ -315,19 +314,16 @@ export default {
     },
     // 确认删除(删除建筑-楼层公用)
     confirmDel() {
-      this.buildDisabled = true
       if (this.delText == "楼层") {
         let delParam = [{ id: this.curFloorId }];
         this.delDialogVis = false;
         deleteFloorInfo(delParam, res => {
           this.$message.success("删除成功");
-          this.buildDisabled = false
           this.init();
         });
       } else {
         // 删除建筑
         if (this.tableData && this.tableData.length) {
-          this.buildDisabled = false
           this.$message.error("当前建筑中包含楼层,不可删除");
           this.delDialogVis = false;
         } else {
@@ -335,7 +331,6 @@ export default {
           this.delDialogVis = false;
           deleteBuildInfo(param, res => {
             this.$message.success("删除成功");
-            this.buildDisabled = false
             this.handleBuildQuery()
             this.init()
           })