From ed52d8cb0db78eb8bff70329ac01a38d50d7f672 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期三, 04 十二月 2024 16:20:13 +0800
Subject: [PATCH] 数据授权

---
 Source/plt-web/plt-web-ui/src/views/system/role/index.vue |   54 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
index 06c3d4a..9858341 100644
--- a/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/system/role/index.vue
@@ -30,7 +30,7 @@
       </template>
     </avue-crud>
 
-    <!-- 鍒嗛厤瑙掕壊绌挎妗�   -->
+    <!-- 鍒嗛厤鎴愬憳绌挎妗�   -->
     <transfer ref="transfer" :left-role-data="leftRoleData" :right-role-data="rightRoleData"
               :transferTitle="transferTitle" title="瑙掕壊娣诲姞鎴愬憳"
               @transferSend="roleSendHandler">
@@ -53,14 +53,15 @@
       </avue-crud>
       <div slot="footer" class="dialog-footer" style="display: flex;gap: 20px;justify-content: center">
         <div>
-          <el-tag>褰撳墠瑙掕壊鎬讳汉鏁�: {{this.countData.length}}</el-tag>
+          <el-tag>褰撳墠瑙掕壊鎬讳汉鏁�: {{ this.countData.length }}</el-tag>
         </div>
-        <el-button size="small" @click="statisticsVisible = false" icon="el-icon-close" type="danger">鍏� 闂�</el-button>
+        <el-button icon="el-icon-close" size="small" type="danger" @click="statisticsVisible = false">鍏� 闂�</el-button>
       </div>
     </el-dialog>
 
     <!-- 瀵煎叆瑙掕壊  -->
-    <upload-file ref="upload" :tipList="tipList" :fileType="upFileType" :fileUrl="fileUrl" @updata="getTableList" title="瀵煎叆瑙掕壊"></upload-file>
+    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="瀵煎叆瑙掕壊"
+                 @updata="getTableList"></upload-file>
 
   </basic-container>
 </template>
@@ -77,6 +78,7 @@
 } from '@/api/system/role/api'
 import basicOption from "@/util/basic-option";
 import {column} from "@/views/system/role/option";
+import func from "@/util/func";
 
 export default {
   name: "index",
@@ -87,8 +89,8 @@
         ...basicOption,
         dialogTop: 0,
         dialogWidth: '30%',
+        column: column,
         calcHeight: -60,
-        column: column
       },
       page: {
         currentPage: 1,
@@ -107,10 +109,11 @@
       countData: [],
       countOption: {
         ...basicOption,
-        selection:false,
+        selection: false,
         refreshBtn: false,
-        addBtn:false,
-        menu:false,
+        addBtn: false,
+        menu: false,
+        header:false,
         column: [
           {
             label: '閮ㄩ棬',
@@ -137,7 +140,7 @@
       },
       upFileType: ['xls', 'xlsx'],
       fileUrl: 'api/roleQueryController/importRole',
-      tipList:["瑙掕壊瀵煎叆鍙湁 鍚嶇О 鍜� 鎻忚堪 涓ゅ垪锛屼笖鍚嶇О涓哄繀杈撻」涓嶈兘涓虹┖"]
+      tipList: ["瑙掕壊瀵煎叆鍙湁 鍚嶇О 鍜� 鎻忚堪 涓ゅ垪锛屼笖鍚嶇О涓哄繀杈撻」涓嶈兘涓虹┖"]
     }
   },
   methods: {
@@ -174,27 +177,32 @@
 
     // 琛屽崟閫�
     rowClickHandler(row) {
-      this.$refs.roleCrud.toggleRowSelection(row);
+      func.rowClickHandler(
+        row,
+        this.$refs.roleCrud,
+        this.lastIndex,
+        (newIndex) => { this.lastIndex = newIndex; },
+        () => { this.selectList = [row]; }
+      );
     },
 
     // 娣诲姞
-    rowSaveHandler(row, done,loading) {
+    rowSaveHandler(row, done, loading) {
       delete row.roleClassifyText;
       addRole(row).then(res => {
-        console.log(res)
         if (res.data.code === 200) {
           this.$message.success(res.data.obj);
           this.getTableList();
           done();
         }
-      }).catch(err =>{
+      }).catch(err => {
         console.log(err);
         loading();
       })
     },
 
     // 缂栬緫
-    rowUpdateHandler(row, index, done,loading) {
+    rowUpdateHandler(row, index, done, loading) {
       delete row.roleClassifyText;
       updateRole(row).then(res => {
         if (res.data.code === 200) {
@@ -204,7 +212,6 @@
         }
       }).catch(err => {
         loading();
-        console.log(err);
       });
     },
 
@@ -276,6 +283,8 @@
         listUserUnInRoleOid({pkRole: this.selectList[0].oid}),
         listUserByRoleOid({pkRole: this.selectList[0].oid})
       ]).then(([unInRoleRes, byRoleRes]) => {
+        this.leftRoleData=[];
+        this.rightRoleData=[];
         if (unInRoleRes.data.code === 200 && byRoleRes.data.code === 200) {
           const leftData = [...unInRoleRes.data.data, ...byRoleRes.data.data];
           // 缁勮濂界┛姊鍙敤鏁版嵁
@@ -288,8 +297,6 @@
           this.rightRoleData = byRoleRes.data.data.map(item => item.oid);
           this.$refs.transfer.visible = true;
         }
-      }).catch(err => {
-        console.error(err);
       });
 
     },
@@ -303,8 +310,6 @@
       saveRight(params).then(res => {
         this.$message.success(res.data.obj);
         this.getTableList();
-      }).catch(err => {
-        this.$message.error(err)
       })
     },
 
@@ -320,26 +325,23 @@
         return;
       }
       listUserByRoleOid({pkRole: this.selectList[0].oid}).then(res => {
-        console.log(res)
         if (res.data.code === 200) {
           const data = res.data.data;
           this.countData = data.map(item => {
             return {
               pkDepartmentName: item.pkDepartmentName,
-              name:item.name,
-              id:item.id,
-              pkPersonName:this.selectList[0].name
+              name: item.name,
+              id: item.id,
+              pkPersonName: this.selectList[0].name
             }
           });
           this.statisticsVisible = true;
         }
-      }).catch(err => {
-        console.log(err)
       })
     },
 
     // 瀵煎叆瑙掕壊
-    upLoadRole(){
+    upLoadRole() {
       this.$refs.upload.visible = true;
     }
   }

--
Gitblit v1.9.3