Browse Source

获取公司接口修改

Reiskuchen 5 years ago
parent
commit
5637e37549
3 changed files with 57 additions and 44 deletions
  1. 1 0
      ys_vue/src/port.js
  2. 30 38
      ys_vue/src/views/mold/moldList.vue
  3. 26 6
      ys_vue/src/views/project/staff.vue

+ 1 - 0
ys_vue/src/port.js

@@ -85,6 +85,7 @@ export default {
         relationList: '/company/relationList', //建立关联公司时的公司列表
         ownerComps: '/company/ownerRelateCompany', //返回当前公司的关联公司列表
         getCompanyByPro: '/company/getProduceCompany', //根据项目id获取项目的生产方公司
+        getInfo: '/company/getProduceCompanyByCurrentUser', //根据当前人登录人所能看到的公司进行 项目 模具 的筛选
 
 
         addFactory: '/factory/add',  //(工厂)

+ 30 - 38
ys_vue/src/views/mold/moldList.vue

@@ -190,6 +190,7 @@
         },
         methods: {
             getMsg() {
+                //获取模具
                 this.http.post( this.port.base.moulds, {
                     belongCompanyId: this.user.companyId
                 },
@@ -210,49 +211,44 @@
                         type: "error"
                     });
                 });
-
-                this.http.post( this.port.base.ownerComps, {
-                    id: this.user.companyId
-                },
-                res => {
+                //获取公司
+                // this.http.post( this.port.base.ownerComps, {
+                //     id: this.user.companyId
+                // },
+                // res => {
+                //     if (res.code == "ok") {
+                //         this.companys = res.data;
+                //     } else {
+                //         this.$message({
+                //             message: res.msg,
+                //             type: "error"
+                //         });
+                //     }
+                // },
+                // error => {
+                //     this.listLoading = false;
+                //     this.$message({
+                //         message: error,
+                //         type: "error"
+                //     });
+                // });
+                //新版获取公司
+                this.http.post(this.port.base.getInfo, {}, res => {
                     if (res.code == "ok") {
                         this.companys = res.data;
-                    } else {
-                        this.$message({
-                        message: res.msg,
-                        type: "error"
-                        });
-                    }
-                },
-                error => {
-                    this.listLoading = false;
-                    this.$message({
-                        message: error,
-                        type: "error"
-                    });
-                });
-
-                this.http.post( this.port.project.projects, {},
-                res => {
-                    if (res.code == "ok") {
-                        this.projects = res.data;
                     } else {
                         this.$message({
                             message: res.msg,
-                            type: "error"
+                            type: 'error'
                         });
                     }
-                },
-                error => {
-                    this.listLoading = false;
+                }, error => {
                     this.$message({
                         message: error,
-                        type: "error"
+                        type: 'error'
                     });
                 });
-            },
-            //超级管理员获取项目列表
-            getMsg2(){
+                //获取项目
                 this.http.post( this.port.project.projects, {},
                 res => {
                     if (res.code == "ok") {
@@ -415,7 +411,7 @@
                         });
                     }
                 });
-            }
+            },
         },
         created() {
             let height = window.innerHeight;
@@ -426,11 +422,7 @@
             };
         },
         mounted() {
-            if(this.user.id != 1){
-                this.getMsg();
-            }else{
-                this.getMsg2();
-            }
+            this.getMsg();
             this.getMoldList();
         }
     };

+ 26 - 6
ys_vue/src/views/project/staff.vue

@@ -244,13 +244,10 @@
                 });
             },
 
-            //获取所有公司
+            //新版获取所有公司
             getAllCompanies(){
                 this.allCompanies = [];
-                this.http.post(this.port.base.companys, {
-                    id: this.user.id,
-                    parentId: this.user.parentId
-                }, res => {
+                this.http.post(this.port.base.getInfo, {}, res => {
                     if (res.code == "ok") {
                         this.allCompanies = res.data;
                     } else {
@@ -264,9 +261,32 @@
                         message: error,
                         type: 'error'
                     });
-                })
+                });
             },
 
+            //旧版获取所有公司
+            // getAllCompanies2(){
+            //     this.allCompanies = [];
+            //     this.http.post(this.port.base.companys, {
+            //         id: this.user.id,
+            //         parentId: this.user.parentId
+            //     }, res => {
+            //         if (res.code == "ok") {
+            //             this.allCompanies = res.data;
+            //         } else {
+            //             this.$message({
+            //                 message: res.msg,
+            //                 type: 'error'
+            //             });
+            //         }
+            //     }, error => {
+            //         this.$message({
+            //             message: error,
+            //             type: 'error'
+            //         });
+            //     })
+            // },
+
             //分页
 			handleCurrentChange(val) {
 				this.page = val;