Browse Source

角色管理修改

zhaoke 3 năm trước cách đây
mục cha
commit
b389a8a366

+ 30 - 5
src/views/authorityManagement/components/authorityRoleHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 14:37:54
- * @LastEditTime: 2022-02-08 11:03:58
+ * @LastEditTime: 2022-02-08 11:26:39
  * @LastEditors: Please set LastEditors
  * @Description: 角色管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityRole.vue
@@ -100,7 +100,8 @@ export default {
       PageSize: 20,
       loading: false,
       keyWords: '',
-      total: null
+      total: null,
+      search: null
     }
   },
   created () {
@@ -144,11 +145,23 @@ export default {
     },
     //查询
     getSearchData (val) {
-      this.gueryRole(val)
+      this.pageNum = 1
+      this.search = val
+      this.gueryRole({
+        QueryName: val,
+        PageSize: this.PageSize,
+        PageIndex: this.pageNum
+      }, true)
     },
     //清除查询
     clearSearchData () {
-      this.gueryRole()
+      this.pageNum = 1
+      this.keyWords = ''
+      this.gueryRole({
+        QueryName: '',
+        PageSize: this.PageSize,
+        PageIndex: this.pageNum
+      }, true)
     },
     //状态变更
     async handleChange (item) {
@@ -161,7 +174,19 @@ export default {
         })
         if (res.code === 0) {
           this.$message.success(res.message)
-          this.gueryRole()
+          if (this.search) {
+            this.gueryRole({
+              QueryName: this.search,
+              PageSize: this.PageSize,
+              PageIndex: this.pageNum
+            }, true)
+          } else {
+            this.gueryRole({
+              QueryName: this.keyWords,
+              PageSize: this.PageSize,
+              PageIndex: this.pageNum
+            }, true)
+          }
         } else {
           this.$message.error(res.message)
         }

+ 9 - 4
src/views/authorityManagement/minixs/roleData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-24 11:36:07
- * @LastEditTime: 2022-02-08 10:47:11
+ * @LastEditTime: 2022-02-08 11:19:49
  * @LastEditors: Please set LastEditors
  * @Description: 权限公用
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\roleData.js
@@ -19,7 +19,7 @@ export default {
   },
   methods: {
     //获取列表数据
-    async gueryRole (obj) {
+    async gueryRole (obj, type = '') {
       try {
         this.loading = true
         const res = await QueryRole(obj)
@@ -29,8 +29,13 @@ export default {
             item.isauto = item.Status == 1 ? true : false
           })
           const num = Math.ceil(res.returnData.total / 20)
-          this.dataList.push(datas)
-          const arrs = this.dataList.flat()
+          let arrs = []
+          if (type) {
+            arrs = datas
+          } else {
+            this.dataList.push(datas)
+            arrs = this.dataList.flat()
+          }
           this.arrs = arrs
           this.total = num
           this.loading = false