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/index.vue                  |   28 +--------
 src/api/backgroundConfig/rolePermssion.js                           |   19 ++++++
 src/api/backgroundConfig/memberManage.js                            |   10 +++
 src/views/backgroundConfig/rolePermssion/AddRolePermssionDialog.vue |   64 ++++++++++++++++++---
 4 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/src/api/backgroundConfig/memberManage.js b/src/api/backgroundConfig/memberManage.js
new file mode 100644
index 0000000..e07acdb
--- /dev/null
+++ b/src/api/backgroundConfig/memberManage.js
@@ -0,0 +1,10 @@
+import request from "@/common/untils/request.js"
+
+// 鏂板鐢ㄦ埛锛堟敞鍐岃处鍙凤級
+export function registerUser(data) {
+  return request({
+    url: "/api/user/register",
+    method: "post",
+    data
+  })
+}
diff --git a/src/api/backgroundConfig/rolePermssion.js b/src/api/backgroundConfig/rolePermssion.js
new file mode 100644
index 0000000..c1e3f76
--- /dev/null
+++ b/src/api/backgroundConfig/rolePermssion.js
@@ -0,0 +1,19 @@
+import request from "@/common/untils/request.js"
+
+// 鍒涘缓瑙掕壊
+export function addAuthority(data) {
+  return request({
+    url: "/api/authority/add",
+    method: "post",
+    data
+  })
+}
+
+// 璁剧疆瑙掕壊鑿滃崟
+export function setMenuAuthority(data) {
+  return request({
+    url: "/api/authority/setMenuAuthority",
+    method: "post",
+    data
+  })
+}
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) {
diff --git a/src/views/backgroundConfig/rolePermssion/index.vue b/src/views/backgroundConfig/rolePermssion/index.vue
index 53c2e70..9f965a6 100644
--- a/src/views/backgroundConfig/rolePermssion/index.vue
+++ b/src/views/backgroundConfig/rolePermssion/index.vue
@@ -56,13 +56,13 @@
         tableInfomation: [
           {
             number: "1",
-            owner: "鎬荤粡鐞�",
+            authorityName: "鎬荤粡鐞�",
             notes: ""
           }
         ],
         tableColumn: [
           { label: "#", prop: "number", width: 80 },
-          { label: "鏉冮檺鍚嶇О", prop: "owner", width: 160 },
+          { label: "鏉冮檺鍚嶇О", prop: "authorityName", width: 160 },
           { label: "澶囨敞", prop: "notes" }
         ]
       }
@@ -76,34 +76,14 @@
     addBtnClick() {
       this.editConfig.visible = true
       this.editConfig.title = "鏂板缓"
-      this.editConfig.infomation = {
-        customName: "",
-        documentNumber: "ZDYBD01-3",
-        owner: "",
-        contractStatus: "",
-        salesQuotation: "",
-        approvalWorkflow: "",
-        approvalSteps: "",
-        approvalPerson: "",
-        approvalOpinion: ""
-      }
+      this.editConfig.infomation = {}
     },
     // 缂栬緫
     handleClick(row) {
       console.log(row)
       this.editConfig.visible = true
       this.editConfig.title = "缂栬緫"
-      this.editConfig.infomation = {
-        customName: "",
-        documentNumber: "TKD20230521-12",
-        owner: "",
-        contractStatus: "",
-        salesQuotation: "",
-        approvalWorkflow: "",
-        approvalSteps: "",
-        approvalPerson: "",
-        approvalOpinion: ""
-      }
+      this.editConfig.infomation = { ...row }
     }
   }
 }

--
Gitblit v1.8.0