Browse Source

contract bug

wangguangping 3 years ago
parent
commit
894cd74ec3
1 changed files with 77 additions and 54 deletions
  1. 77 54
      src/pages/main/advertising/contractCap.vue

+ 77 - 54
src/pages/main/advertising/contractCap.vue

@@ -74,7 +74,7 @@
                     </el-table-column>
                     <!-- <el-table-column prop="advYearn" :label="advYearnLabel">
 					</el-table-column> -->
-                    <el-table-column label="操作" width="160px" align="center">
+                    <el-table-column label="操作" width="160px" align="center" v-if="userInfo.countyName == null && userInfo.cityName != null">
                         <template slot-scope="scope">
                             <!-- <el-button
                                 size="mini"
@@ -86,6 +86,7 @@
                                 size="mini"
                                 type="primary"
                                 @click="dialogCheck(2, scope.row)" 
+                                v-if="userInfo.countyName == null && userInfo.cityName != null"
                                 >编辑</el-button>
                             <!-- <el-button
                                 size="mini"
@@ -149,7 +150,6 @@
                             <el-input
                                 v-model="infolist.secbuyLastAccount"
                                 placeholder="二采剩余预算"
-                                :disabled="secbuyLastDisableStatus"
                             ></el-input>
                         </el-form-item>
                         <!-- <el-form-item prop="secbuySchedule">
@@ -292,7 +292,8 @@ export default {
             countyOpt: [],
             areaCode: "",
             areaName: "",
-            supplierArr: []
+            supplierArr: [],
+            currentRole: []
         };
     },
     computed: {
@@ -370,13 +371,13 @@ export default {
             if (v === 1) {
                 this.titname = "查看";
                 this.disableStatus = true;
-                this.getComp(v.regionCode);
+                // this.getComp(v.regionCode);
                 return;
             } else if (v === 2) {
                 this.titname = "编辑";
                 this.disableStatus = false;
                 this.secbuyLastDisableStatus = true;
-                this.getComp(v.regionCode);
+                // this.getComp(v.regionCode);
             } else if (v === 3) {
                 this.titname = "添加";
                 this.secbuyLastDisableStatus = false;
@@ -398,22 +399,30 @@ export default {
                 );
                 this.infolist.areaCode = this.areaCode;
                 this.infolist.areaName = this.areaName;
-                
+
+                // console.log(this.currentRole);
+                if(this.currentRole.length == 1){
+                   this.infolist.regionName = this.currentRole[0].compName;
+                   this.infolist.regionCode = this.currentRole[0].compId;
+                }
+                console.log(this.infolist);
+
                 if (this.titname === "添加") {
-                    this.submitInfo("/market/cadvContract/add");
+                this.submitInfo("/market/cadvContract/add");
                 } else if (this.titname === "编辑") {
                     this.submitInfo("/market/cadvContract/update", v);
                 }
+                
             }
         },
         submitInfo(u) {
             // callback(new Error('不能为空'))
-            if (
-                this.infolist.secbuyPreAccount <=
-                this.infolist.secbuyLastAccount
-            ) {
-                new Error("二采预算总额应大于二采剩余预算");
-            }
+            // if (
+            //     this.infolist.secbuyPreAccount <=
+            //     this.infolist.secbuyLastAccount
+            // ) {
+            //     new Error("二采预算总额应大于二采剩余预算");
+            // }
 
             let _this = this;
             this.$refs.infolist.validate(valid => {
@@ -495,40 +504,42 @@ export default {
                 this.fullscreen = !this.fullscreen;
             }
         },
-        verifcheck(v) {
-            if (v == 2) {
-                for (let i = 0; i < this.countyOpt.length; i++) {
-                    if (this.countyOpt[i].compId === this.areaCode) {
-                        this.areaName = this.countyOpt[i].compName;
-                    }
-                }
-            } else {
-                for (let i = 0; i < this.regionOpt.length; i++) {
-                    if (this.regionOpt[i].compId === this.infolist.regionCode) {
-                        this.infolist.regionName = this.regionOpt[i].compName;
-                        this.areaCode = "";
-                        this.areaName = "";
-                        this.getComp(this.regionOpt[i].compId);
-                    }
-                }
-            }
-        },
-        getComp(v) {
-            this.$http({
-                url: "/sysmgr/regionComp/queryList",
-                method: "post",
-                headers: {
-                    "Content-Type": "application/json"
-                },
-                data: {
-                    parentCompId: v
-                }
-            }).then(res => {
-                this.countyOpt = res.data;
-            });
-        },
+        // verifcheck(v) {
+        //     if (v == 2) {
+        //         for (let i = 0; i < this.countyOpt.length; i++) {
+        //             if (this.countyOpt[i].compId === this.areaCode) {
+        //                 this.areaName = this.countyOpt[i].compName;
+        //             }
+        //         }
+        //     } else {
+        //         for (let i = 0; i < this.regionOpt.length; i++) {
+        //             if (this.regionOpt[i].compId === this.infolist.regionCode) {
+        //                 this.infolist.regionName = this.regionOpt[i].compName;
+        //                 this.areaCode = "";
+        //                 this.areaName = "";
+        //                 this.getComp(this.regionOpt[i].compId);
+        //             }
+        //         }
+        //     }
+        // },
+        // getComp(v) {
+        //     this.$http({
+        //         url: "/sysmgr/regionComp/queryList",
+        //         method: "post",
+        //         headers: {
+        //             "Content-Type": "application/json"
+        //         },
+        //         data: {
+        //             parentCompId: v
+        //         }
+        //     }).then(res => {
+        //         this.countyOpt = res.data;
+        //     });
+        // },
         getUser() {
             this.userInfo = JSON.parse(window.sessionStorage.userInfo);
+
+            console.log();
             this.$http({
                 url: "/sysmgr/regionComp/queryList",
                 method: "post",
@@ -540,15 +551,27 @@ export default {
                 }
             }).then(res => {
                 // this.regionOpt = res.data;
-                if (
-                    this.userInfo.countyName == null && this.userInfo.cityName == null
-                ) {
-                    this.regionOpt = res.data;
-                } else if (this.userInfo.countyName == null && this.userInfo.cityName != null) {
-                    this.regionOpt = res.data.filter(item => {
-                        return item.compName == this.userInfo.cityName;
-                    });
-                }
+                // console.log(res.data);
+                this.currentRole = res.data.filter(item=>{
+                    return item.compName == this.userInfo.cityName
+                })
+                // this.currentRole = JSON.parse(JSON.stringify(this.currentRole))
+                // console.log(this.currentRole);
+                
+                // if(this.currentRole.length == 1){
+                //    this.infolist.regionName = this.currentRole[0].compName;
+                //    this.infolist.regionCode = this.currentRole[0].compId;
+                // }
+                // console.log(this.infolist.regionName);
+                // if (
+                //     this.userInfo.countyName == null && this.userInfo.cityName == null
+                // ) {
+                //     this.regionOpt = res.data;
+                // } else if (this.userInfo.countyName == null && this.userInfo.cityName != null) {
+                //     this.regionOpt = res.data.filter(item => {
+                //         return item.compName == this.userInfo.cityName;
+                //     });
+                // }
             });
         }
     },