From 51ce81df657be1e2eb5cfd8f21ebe731d8d3444b Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期五, 21 七月 2023 10:29:14 +0800
Subject: [PATCH] 后台配置相关

---
 src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue |   64 +++++++++++++++++++++++++++----
 1 files changed, 55 insertions(+), 9 deletions(-)

diff --git a/src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue b/src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue
index c0e7418..6b55bd2 100644
--- a/src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue
+++ b/src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue
@@ -21,8 +21,8 @@
           <div class="basic-info-view">
             <el-row>
               <el-col :span="12">
-                <el-form-item label="鏉冮檺鍚嶇О" prop="owner">
-                  <el-input v-model="editConfig.infomation.owner"></el-input>
+                <el-form-item label="鏉冮檺鍚嶇О" prop="authorityName">
+                  <el-input v-model="editConfig.infomation.authorityName"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="12">
@@ -90,7 +90,7 @@
           </div>
         </div>
         <div class="btn">
-          <el-button type="primary" size="small" @click="editConfig.visible = false">淇� 瀛�</el-button>
+          <el-button type="primary" size="small" @click="saveClick('form')">淇� 瀛�</el-button>
           <el-button size="small" @click="editConfig.visible = false">鍙� 娑�</el-button>
         </div>
       </div>
@@ -99,6 +99,7 @@
 </template>
 
 <script>
+import { addAuthority } from "@/api/backgroundConfig/rolePermssion" // setMenuAuthority
 export default {
   name: "AddRolePermissionDialog",
   props: {
@@ -108,10 +109,7 @@
         return {
           visible: false,
           title: "鏂板缓",
-          infomation: {
-            owner: "",
-            notes: ""
-          }
+          infomation: {}
         }
       }
     }
@@ -141,7 +139,7 @@
       dialogWidth: "60%",
       editConfig: this.editCommonConfig,
       rules: {
-        owner: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }]
+        authorityName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }]
       },
       moduleSelTitle: "鍏ㄩ儴",
       tableData: [],
@@ -159,6 +157,52 @@
   methods: {
     handleClose() {
       this.editConfig.visible = false
+    },
+    saveClick(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          console.log(this.editConfig.infomation)
+          if (this.editConfig.title === "鏂板缓") {
+            addAuthority({
+              authorityName: this.editConfig.infomation.authorityName,
+              casbinInfos: []
+            })
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "娣诲姞鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          } else {
+            // getUpdateClient(params)
+            //   .then((res) => {
+            //     console.log(res)
+            //     this.editConfig.visible = false
+            //     if (res.code === 200) {
+            //       this.$message({
+            //         message: "缂栬緫鎴愬姛",
+            //         type: "success"
+            //       })
+            //       this.$parent.getData()
+            //     }
+            //   })
+            //   .catch((err) => {
+            //     console.log(err)
+            //   })
+          }
+        } else {
+          console.log("error submit")
+          return false
+        }
+      })
     },
     // 妯″潡閫夋嫨
     moduleSelectClick(value) {
@@ -207,7 +251,7 @@
         this.tableData = []
       }
     },
-    // 妯″潡鍏ㄩ��
+    // 妯″潡鍏ㄩ�� / 鍙栨秷鍏ㄩ��
     selAllChange(row) {
       if (row.checked) {
         let arr = []
@@ -215,6 +259,8 @@
           arr.push(ele.name)
         })
         row.checkedList = arr
+      } else {
+        row.checkedList = []
       }
     },
     handleCheckedChange(value, row) {

--
Gitblit v1.8.0