From 9ada19d01d0cb6aaa0dec99e24bf7a9b511750bf Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期六, 06 一月 2024 15:55:31 +0800
Subject: [PATCH] 审核页面和编辑用户页面修改及接口联调

---
 src/views/unifiedManage/userLevel/components/AddUserLevel.vue |   95 +++++++++++++++++++++++++----------------------
 1 files changed, 51 insertions(+), 44 deletions(-)

diff --git a/src/views/unifiedManage/userLevel/components/AddUserLevel.vue b/src/views/unifiedManage/userLevel/components/AddUserLevel.vue
index 62c46f3..cc97951 100644
--- a/src/views/unifiedManage/userLevel/components/AddUserLevel.vue
+++ b/src/views/unifiedManage/userLevel/components/AddUserLevel.vue
@@ -51,7 +51,7 @@
                   :data="item.menus"
                   show-checkbox
                   node-key="id"
-                  @check-change="handleCheckChange"
+                  :default-checked-keys="editConfig.infomation.menuIDs"
                   :props="treeDefaultProp"
                   default-expand-all
                 >
@@ -71,6 +71,7 @@
 
 <script>
 // import codeMixin from "@/components/makepager/mixin/codeMixin"
+import { addRole, updateRole, getDataRole } from "@/api/unifiedManage/userLevel"
 export default {
   name: "AddUserLevel",
   // mixins: [codeMixin],
@@ -83,6 +84,12 @@
           title: "鏂板缓",
           infomation: {}
         }
+      }
+    },
+    editRow: {
+      type: Object,
+      default: () => {
+        return {}
       }
     }
   },
@@ -110,21 +117,25 @@
   watch: {
     "editCommonConfig.visible"(val) {
       if (val) {
+        console.log(val, "sssssss")
+        this.isOpen = val
         this.$refs.form.resetFields()
         this.getDataInfo()
       }
     },
     "editCommonConfig.infomation"(val) {
-      if (this.isopen) {
-        this.$refs.form.resetFields()
-        if (val.id) {
-          this.getDataInfo(val)
-        }
-      }
+      console.log(val, "aaaa")
+      // if (this.isopen) {
+      //   this.$refs.form.resetFields()
+      //   if (val.id) {
+      //     this.getDataInfo(val)
+      //   }
+      // }
     }
   },
   created() {
-    this.getDataInfo()
+    console.log(this.editConfig.infomation, "sdddd")
+    this.getDataInfo(this.editConfig.infomation)
   },
   methods: {
     handleClose() {
@@ -135,19 +146,19 @@
     },
     // 鑾峰彇鍙傝�冭鑹� 椤甸潰鏉冮檺  鑿滃崟 鐨勬暟鎹�
     async getDataInfo(val) {
-      console.log(val)
-      // const rsp = await getDataRole({ useType: 1 })
-      // if (rsp.code == 200) {
-      //   // 鍙傝�冭鑹�
-      //   this.prepareRoleList = rsp.data.roles ? rsp.data.roles : []
-      //   this.menusList = rsp.data.menus ? rsp.data.menus : []
-      //   // 椤甸潰鏉冮檺
-      //   this.completeList = rsp.data.subsystems ? rsp.data.subsystems : []
-      //   this.form.completeType = this.completeList.length > 0 ? this.completeList[0].systemType : 1
-      // }
-      // if (this.isopen) {
-      //   this.resetForm(val)
-      // }
+      const rsp = await getDataRole({ useType: 1 })
+      if (rsp.code == 200) {
+        // 鍙傝�冭鑹�
+        this.prepareRoleList = rsp.data.roles ? rsp.data.roles : []
+        this.menusList = rsp.data.menus ? rsp.data.menus : []
+        // 椤甸潰鏉冮檺
+        this.completeList = rsp.data.subsystems ? rsp.data.subsystems : []
+        this.form.completeType = this.completeList.length > 0 ? this.completeList[0].systemType : 1
+      }
+      if (this.editConfig.visible) {
+        console.log("ssss")
+        this.resetForm(val)
+      }
     },
     getMenuCheck(val) {
       if (val && val.length > 0) {
@@ -167,21 +178,14 @@
           this.completeList.length > 0 && this.completeList[0].systemType ? this.completeList[0].systemType : 1
       }
       if (val) {
+        console.log("aaaa", val)
         this.form = JSON.parse(JSON.stringify(val))
         this.form.completeType =
           this.completeList.length > 0 && this.completeList[0].systemType ? this.completeList[0].systemType : 1
-        if (this.form.menuIDs && this.form.menuIDs.length > 0) {
-          for (let i in this.menusList) {
-            this.$refs["menuTree&" + this.menusList[i].systemType][0].setCheckedKeys(this.form.allMenu.split(","))
-          }
-        }
-      } else {
-        for (let i in this.menusList) {
-          this.$refs["menuTree&" + this.menusList[i].systemType][0].setCheckedKeys([])
-        }
       }
     },
-    imgClick(item) {
+    imgClick(item, index) {
+      console.log(index)
       this.form.completeType = item.systemType
       this.$forceUpdate()
     },
@@ -203,14 +207,15 @@
       this.$refs[formName].validate((valid) => {
         console.log(valid)
         if (valid) {
-          // let submitFn = this.editRow.id ? updateRole : addRole
-          // let param = this.saveParams()
-          // submitFn(param).then((reply) => {
-          //   if (reply && reply.code === 200) {
-          //     this.$message.success("淇濆瓨鎴愬姛")
-          //     this.$emit("shutdown", false)
-          //   }
-          // })
+          let submitFn = this.editRow.id ? updateRole : addRole
+          let param = this.saveParams()
+          submitFn(param).then((reply) => {
+            if (reply && reply.code === 200) {
+              this.$message.success("淇濆瓨鎴愬姛")
+              this.handleClose()
+              this.$parent.getData()
+            }
+          })
         }
       })
     },
@@ -346,11 +351,13 @@
         box-sizing: border-box;
       }
     }
-    .dialog-footer {
-      background-color: #f5f5f5;
-      height: 55px;
-      line-height: 55px;
-    }
+  }
+  .el-dialog__footer {
+    background-color: #f5f5f5;
+    height: 55px;
+    line-height: 55px;
+    text-align: right;
+    padding-right: 20px;
   }
   .el-input__inner {
     font-size: 13px !important;

--
Gitblit v1.8.0