浏览代码

分权限页面添加页面搜索框

yuanrf 1 年之前
父节点
当前提交
10f5b3bbf5
共有 2 个文件被更改,包括 86 次插入0 次删除
  1. 43 0
      src/components/child/AuthorityJob.vue
  2. 43 0
      src/components/child/AuthorityUser.vue

+ 43 - 0
src/components/child/AuthorityJob.vue

@@ -7,6 +7,11 @@
                         <el-option v-for="item in authority" :key="item.value" :label="item.name" :value="item.id">
                         <el-option v-for="item in authority" :key="item.value" :label="item.name" :value="item.id">
                         </el-option>
                         </el-option>
                     </el-select>
                     </el-select>
+                    <el-select v-model="pageValue" filterable placeholder="页面名称搜索" @change="pageChange">
+                        <el-option v-for="item in pageOptions" :key="item.pageid" :label="item.pageName"
+                            :value="item.pageid">
+                        </el-option>
+                    </el-select>
                 </div>
                 </div>
                 <div class="job-input">
                 <div class="job-input">
                     <el-select @change="companyChange()" v-model="valuecorporation" clearable placeholder="公司">
                     <el-select @change="companyChange()" v-model="valuecorporation" clearable placeholder="公司">
@@ -87,6 +92,8 @@ export default {
             loading: true,
             loading: true,
             userId: 0,
             userId: 0,
             token: '',
             token: '',
+            pageOptions: [],
+            pageValue: ''
         }
         }
     },
     },
     methods: {
     methods: {
@@ -102,6 +109,7 @@ export default {
         //模块下拉框
         //模块下拉框
         Inquirechange() {
         Inquirechange() {
             this.currentPage = 1;
             this.currentPage = 1;
+            this.pageValue = '';
             this.pageload(this.value);
             this.pageload(this.value);
         },
         },
         //多选框选中方法
         //多选框选中方法
@@ -306,12 +314,47 @@ export default {
                 }
                 }
             });
             });
             console.warn(this.authorityLists);
             console.warn(this.authorityLists);
+        },
+        pageChange() {
+            console.log(this.pageValue);
+            var that = this;
+            let ischange = false;
+            this.pageOptions.forEach(function (item, index) {
+                if (item.pageid == that.pageValue) {
+                    ischange = true;
+                    that.value = item.modulid;
+                }
+            })
+
+            if (ischange) {
+                this.Inquirechange();
+            } else {
+                console.log("搜索异常!!");
+            }
+
+        },
+        loadPages() {
+            var that = this;
+            this.$axios.post('/api/System/PageConfigInit', {
+
+            }, {
+                headers: {
+                    'Authorization': that.token,
+                }
+            }).then(resp => {
+                console.log(resp.data.data);
+                if (resp.data.code == 200) {
+                    that.pageOptions = resp.data.data.viewList.data;
+                }
+            })
+
         }
         }
     },
     },
     mounted() {
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         this.pageload(13);
         this.pageload(13);
+        this.loadPages();
     }
     }
 }
 }
 </script>
 </script>

+ 43 - 0
src/components/child/AuthorityUser.vue

@@ -7,6 +7,11 @@
                         <el-option v-for="item in authority" :key="item.value" :label="item.name" :value="item.id">
                         <el-option v-for="item in authority" :key="item.value" :label="item.name" :value="item.id">
                         </el-option>
                         </el-option>
                     </el-select>
                     </el-select>
+                    <el-select v-model="pageValue" filterable placeholder="页面名称搜索" @change="pageChange">
+                        <el-option v-for="item in pageOptions" :key="item.pageid" :label="item.pageName"
+                            :value="item.pageid">
+                        </el-option>
+                    </el-select>
                 </div>
                 </div>
                 <div class="job-input">
                 <div class="job-input">
                     <el-select @change="companyChange()" v-model="valuecorporation" clearable placeholder="公司">
                     <el-select @change="companyChange()" v-model="valuecorporation" clearable placeholder="公司">
@@ -92,6 +97,8 @@ export default {
             Valueuesr: '',//员工val
             Valueuesr: '',//员工val
             userId: 0,
             userId: 0,
             token: '',
             token: '',
+            pageOptions: [],
+            pageValue: ''
         }
         }
     },
     },
     methods: {
     methods: {
@@ -107,6 +114,7 @@ export default {
         //模块下拉框
         //模块下拉框
         Inquirechange() {
         Inquirechange() {
             this.currentPage = 1;
             this.currentPage = 1;
+            this.pageValue = '';
             this.pageload(this.value);
             this.pageload(this.value);
         },
         },
         //多选框选中方法
         //多选框选中方法
@@ -352,12 +360,47 @@ export default {
         },
         },
         unique(arr) {
         unique(arr) {
             return Array.from(new Set(arr));
             return Array.from(new Set(arr));
+        },
+        pageChange() {
+            console.log(this.pageValue);
+            var that = this;
+            let ischange = false;
+            this.pageOptions.forEach(function (item, index) {
+                if (item.pageid == that.pageValue) {
+                    ischange = true;
+                    that.value = item.modulid;
+                }
+            })
+
+            if (ischange) {
+                this.Inquirechange();
+            } else {
+                console.log("搜索异常!!");
+            }
+
+        },
+        loadPages() {
+            var that = this;
+            this.$axios.post('/api/System/PageConfigInit', {
+
+            }, {
+                headers: {
+                    'Authorization': that.token,
+                }
+            }).then(resp => {
+                console.log(resp.data.data);
+                if (resp.data.code == 200) {
+                    that.pageOptions = resp.data.data.viewList.data;
+                }
+            })
+
         }
         }
     },
     },
     mounted() {
     mounted() {
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.token = JSON.parse(localStorage.getItem('userinif')).token;
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
         this.pageload(13);
         this.pageload(13);
+        this.loadPages();
     }
     }
 }
 }
 </script>
 </script>