From 977f591fbc02883bfc9bab3fea793f278d309531 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 14 十月 2022 10:36:02 +0800
Subject: [PATCH] 1

---
 src/views/AuthorizationManagement/userRoleAuthorization.vue |  278 ++++++++++++++++++++++++-------------------------------
 1 files changed, 121 insertions(+), 157 deletions(-)

diff --git a/src/views/AuthorizationManagement/userRoleAuthorization.vue b/src/views/AuthorizationManagement/userRoleAuthorization.vue
index 9d9333c..6fb3476 100644
--- a/src/views/AuthorizationManagement/userRoleAuthorization.vue
+++ b/src/views/AuthorizationManagement/userRoleAuthorization.vue
@@ -1,34 +1,27 @@
 <template>
   <div class="menuSettings_box">
     <div class="menuSettings_tree">
-      <My-bread
-        :list="[
+      <My-bread :list="[
           `${$t('operatManage.operatManage')}`,
           `${$t('operatManage.UserRoleAuthorization')}`,
-        ]"
-      ></My-bread>
+        ]"></My-bread>
 
       <el-divider />
       <div class="menuTreeBox">
-        <el-tree
-          :data="depList"
-          :props="defaultProps"
-          :show-checkbox="true"
-          :check-on-click-node="true"
-          :check-strictly="true"
-          node-key="id"
-          @check="treeCheck"
-          ref="treeForm"
-        >
+        <el-tree :data="depList"
+                 :props="defaultProps"
+                 :show-checkbox="true"
+                 :check-on-click-node="true"
+                 :check-strictly="true"
+                 node-key="id"
+                 @check="treeCheck"
+                 ref="treeForm">
         </el-tree>
       </div>
     </div>
-    <div
-      class="menuSettings_tree"
-      style="margin-left: 10px; width: calc(50% - 172px)"
-    >
-      <div
-        style="
+    <div class="menuSettings_tree"
+         style="margin-left: 10px; width: calc(50% - 172px)">
+      <div style="
           font-size: 14px;
           color: #606266;
           line-height: 1;
@@ -36,53 +29,42 @@
           position: relative;
           top: 10px;
           margin-left: 10px;
-        "
-      >
+        ">
         {{ $t("operatManage.UserRoleAuthorizationObj.RoleTable") }}
       </div>
       <el-divider />
-      <el-table
-        :data="tableData"
-        style="width: 100%"
-        @row-click="singleElection"
-        highlight-current-row
-        height="85%"
-        :header-cell-style="{
+      <el-table :data="tableData"
+                style="width: 100%"
+                @row-click="singleElection"
+                highlight-current-row
+                height="85%"
+                :header-cell-style="{
           background: 'transparent',
-        }"
-      >
-        <el-table-column align="center" width="55">
+        }">
+        <el-table-column align="center"
+                         width="55">
           <template slot-scope="scope">
             <!-- 鍙互鎵嬪姩鐨勪慨鏀筶abel鐨勫�硷紝浠庤�屾帶鍒堕�夋嫨鍝竴椤� -->
-            <el-radio
-              class="radio"
-              v-model="templateSelection"
-              :label="scope.row.id"
-              >&nbsp;</el-radio
-            >
+            <el-radio class="radio"
+                      v-model="templateSelection"
+                      :label="scope.row.id">&nbsp;</el-radio>
           </template>
         </el-table-column>
-        <el-table-column
-          prop="id"
-          :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')"
-        >
+        <el-table-column prop="id"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')">
         </el-table-column>
-        <el-table-column
-          prop="name"
-          :label="$t('operatManage.UserRoleAuthorizationObj.name')"
-        >
+        <el-table-column prop="name"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.name')">
         </el-table-column>
       </el-table>
       <div style="text-align: center; margin-top: 20px">
-        <el-pagination
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-          :current-page="listData.pageIndex"
-          :page-sizes="[10, 20, 30, 40]"
-          :page-size="userlistData.pageSize"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="count"
-        >
+        <el-pagination @size-change="handleSizeChange"
+                       @current-change="handleCurrentChange"
+                       :current-page="listData.pageIndex"
+                       :page-sizes="[10, 20, 30, 40]"
+                       :page-size="userlistData.pageSize"
+                       layout="total, sizes, prev, pager, next, jumper"
+                       :total="count">
         </el-pagination>
       </div>
     </div>
@@ -90,8 +72,7 @@
       <!-- <div class="title_box">
         <h4>璇︾粏淇℃伅</h4>
       </div> -->
-      <div
-        style="
+      <div style="
           font-size: 14px;
           color: #606266;
           line-height: 1;
@@ -101,104 +82,85 @@
           margin-left: 10px;
           display: flex;
           align-items: center;
-        "
-      >
+        ">
         <span>
-          {{ $t("operatManage.UserRoleAuthorizationObj.userTable") }}</span
-        >
-        <div class="btn" style="margin-left: auto">
-          <el-button
-            type="primary"
-            icon="el-icon-circle-plus-outline"
-            size="small"
-            :disabled="roleid == null ? true : false"
-            @click="adduser"
-            >{{ $t("operatManage.UserRoleAuthorizationObj.Added") }}</el-button
-          >
-          <el-button
-            type="danger"
-            icon="el-icon-delete"
-            size="small"
-            @click="deletesUser"
-            :disabled="roleid == null ? true : false"
-            >{{ $t("operatManage.UserRoleAuthorizationObj.delete") }}</el-button
-          >
+          {{ $t("operatManage.UserRoleAuthorizationObj.userTable") }}</span>
+        <div class="btn"
+             style="margin-left: auto">
+          <el-button type="primary"
+                     icon="el-icon-circle-plus-outline"
+                     size="small"
+                     :disabled="roleid == null ? true : false"
+                     @click="adduser">{{ $t("operatManage.UserRoleAuthorizationObj.Added") }}</el-button>
+          <el-button type="danger"
+                     icon="el-icon-delete"
+                     size="small"
+                     @click="deletesUser"
+                     :disabled="roleid == null ? true : false">{{ $t("operatManage.UserRoleAuthorizationObj.delete") }}</el-button>
         </div>
       </div>
       <el-divider class="divider" />
 
-      <el-table
-        :data="usertableData"
-        stripe
-        style="width: 100%"
-        height="85%"
-        @selection-change="handleSelectionChange"
-        :header-cell-style="{
+      <el-table :data="usertableData"
+                stripe
+                style="width: 100%"
+                height="85%"
+                @selection-change="handleSelectionChange"
+                :header-cell-style="{
           background: 'transparent',
-        }"
-      >
-        <el-table-column type="selection" width="55"> </el-table-column>
-        <el-table-column
-          prop="id"
-          :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')"
-        >
+        }">
+        <el-table-column type="selection"
+                         width="55"> </el-table-column>
+        <el-table-column prop="id"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')">
         </el-table-column>
-        <el-table-column
-          prop="uname"
-          :label="$t('operatManage.UserRoleAuthorizationObj.name')"
-        >
+        <el-table-column prop="uname"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.name')">
         </el-table-column>
       </el-table>
 
-      <div style="margin-top: 20px; text-align: center" class="pagination_box">
-        <el-pagination
-          @size-change="userhandleSizeChange"
-          @current-change="userhandleCurrentChange"
-          :current-page="userlistData.pageIndex"
-          :page-sizes="[10, 20, 30, 40]"
-          :page-size="userlistData.pageSize"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="usercount"
-        >
+      <div style="margin-top: 20px; text-align: center"
+           class="pagination_box">
+        <el-pagination @size-change="userhandleSizeChange"
+                       @current-change="userhandleCurrentChange"
+                       :current-page="userlistData.pageIndex"
+                       :page-sizes="[10, 20, 30, 40]"
+                       :page-size="userlistData.pageSize"
+                       layout="total, sizes, prev, pager, next, jumper"
+                       :total="usercount">
         </el-pagination>
       </div>
     </div>
-    <el-dialog
-      :title="$t('operatManage.UserRoleAuthorizationObj.Added')"
-      :visible.sync="dialogTableVisible"
-    >
-      <el-table
-        :data="gridData"
-        height="40vh"
-        @selection-change="addhandleSelectionChange"
-      >
-        <el-table-column type="selection" width="55"> </el-table-column>
-        <el-table-column
-          prop="id"
-          :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')"
-        >
+    <el-dialog :title="$t('operatManage.UserRoleAuthorizationObj.Added')"
+               :visible.sync="dialogTableVisible">
+      <el-table :data="gridData"
+                height="40vh"
+                @selection-change="addhandleSelectionChange">
+        <el-table-column type="selection"
+                         width="55"> </el-table-column>
+        <el-table-column prop="id"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.serialNumber')">
         </el-table-column>
-        <el-table-column
-          prop="uname"
-          :label="$t('operatManage.UserRoleAuthorizationObj.name')"
-        >
+        <el-table-column prop="uname"
+                         :label="$t('operatManage.UserRoleAuthorizationObj.name')">
         </el-table-column>
       </el-table>
-      <div style="margin-top: 20px; text-align: center" class="pagination_box">
-        <el-pagination
-          @size-change="addhandleSizeChange"
-          @current-change="addhandleCurrentChange"
-          :current-page="addlistData.pageIndex"
-          :page-sizes="[10, 20, 30, 40]"
-          :page-size="addlistData.pageSize"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="addcount"
-        >
+      <div style="margin-top: 20px; text-align: center"
+           class="pagination_box">
+        <el-pagination @size-change="addhandleSizeChange"
+                       @current-change="addhandleCurrentChange"
+                       :current-page="addlistData.pageIndex"
+                       :page-sizes="[10, 20, 30, 40]"
+                       :page-size="addlistData.pageSize"
+                       layout="total, sizes, prev, pager, next, jumper"
+                       :total="addcount">
         </el-pagination>
       </div>
-      <div slot="footer" class="dialog-footer">
+      <div slot="footer"
+           class="dialog-footer">
         <el-button @click="dialogTableVisible = false">{{ $t("dataManage.dictionaryManageObj.cancel") }}</el-button>
-        <el-button type="primary" @click="addConfirm">{{ $t("dataManage.dictionaryManageObj.confirm") }}</el-button>
+        <el-button type="primary"
+                   @click="addConfirm">{{ $t("dataManage.dictionaryManageObj.confirm") }}</el-button>
       </div>
     </el-dialog>
   </div>
@@ -220,7 +182,7 @@
     MyBread,
   },
 
-  data() {
+  data () {
     return {
       addcount: 0,
       gridData: [],
@@ -261,7 +223,7 @@
     };
   },
   methods: {
-    addConfirm() {
+    addConfirm () {
       this.$confirm("纭畾鏄惁鏂板", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
@@ -280,15 +242,17 @@
             type: "success",
             message: "鏂板鎴愬姛!",
           });
+          this.dialogTableVisible = false;
+          this.getuserList();
         })
-        .catch(() => {});
+        .catch(() => { });
     },
-    adduser() {
+    adduser () {
       this.dialogTableVisible = true;
       this.getadduserList();
     },
     //鐢ㄦ埛鍒犻櫎
-    async deletesUser() {
+    async deletesUser () {
       let arr = [];
       this.usermultipleSelection.forEach((e) => {
         arr.push(e.id);
@@ -304,45 +268,45 @@
       this.getuserList();
     },
     //鐢ㄦ埛琛ㄥ閫�
-    handleSelectionChange(val) {
+    handleSelectionChange (val) {
       this.usermultipleSelection = val;
     },
     //鏂板鐢ㄦ埛琛ㄥ閫�
-    addhandleSelectionChange(val) {
+    addhandleSelectionChange (val) {
       this.addmultipleSelection = val;
     },
     // 鏂板鐢ㄦ埛琛ㄥ垎椤�
-    addhandleSizeChange(val) {
+    addhandleSizeChange (val) {
       this.addlistData.pageSize = val;
       this.getadduserList();
     },
     // 鏂板鐢ㄦ埛琛ㄥ垎椤�
-    addhandleCurrentChange(val) {
+    addhandleCurrentChange (val) {
       this.addlistData.pageIndex = val;
       this.getadduserList();
     },
     // 鐢ㄦ埛琛ㄥ垎椤�
-    userhandleSizeChange(val) {
+    userhandleSizeChange (val) {
       this.userlistData.pageSize = val;
       this.getuserList();
     },
     // 鐢ㄦ埛琛ㄥ垎椤�
-    userhandleCurrentChange(val) {
+    userhandleCurrentChange (val) {
       this.userlistData.pageIndex = val;
       this.getuserList();
     },
     // 瑙掕壊琛ㄥ垎椤�
-    handleSizeChange(val) {
+    handleSizeChange (val) {
       this.listData.pageSize = val;
       this.getRole();
     },
     // 瑙掕壊琛ㄥ垎椤�
-    handleCurrentChange(val) {
+    handleCurrentChange (val) {
       this.listData.pageIndex = val;
       this.getRole();
     },
     // 瑙掕壊鍗曢��
-    singleElection(row) {
+    singleElection (row) {
       this.templateSelection = row.id;
       this.checkList = this.tableData.filter((item) => item.id === row.id);
       this.userlistData.roleid = row.id;
@@ -350,7 +314,7 @@
       this.getuserList();
     },
     // 閮ㄩ棬璇锋眰
-    async getMenuTree() {
+    async getMenuTree () {
       //鑾峰彇鐩綍鏍戞渶澶D锛屾柊寤鸿妭鐐逛娇鐢�
       const data = await queryDepTree();
 
@@ -359,7 +323,7 @@
       }
       this.depList = this.treeData(data.result);
     },
-    treeData(source) {
+    treeData (source) {
       let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕
       return cloneData.filter((father) => {
         // 寰幆鎵�鏈夐」
@@ -369,7 +333,7 @@
       });
     },
     // 閮ㄩ棬鏍戝崟閫�
-    treeCheck(node, list) {
+    treeCheck (node, list) {
       //node 璇ヨ妭鐐规墍瀵瑰簲鐨勫璞°�乴ist 鏍戠洰鍓嶇殑閫変腑鐘舵�佸璞�
       //閫変腑浜嬩欢鍦ㄩ�変腑鍚庢墽琛岋紝褰搇is涓湁涓や釜閫変腑鏃讹紝浣跨敤setCheckedKeys鏂规硶锛岄�変腑涓�涓妭鐐�
       console.log(node, list);
@@ -388,7 +352,7 @@
         this.usertableData = [];
       }
     },
-    async getadduserList() {
+    async getadduserList () {
       this.addlistData.roleid = this.roleid;
 
       this.addlistData.debid = this.debid;
@@ -400,7 +364,7 @@
       this.addcount = data.count;
     },
     // 鐢ㄦ埛琛ㄨ姹�
-    async getuserList() {
+    async getuserList () {
       const data = await roleUserselectByPageForRole(this.userlistData);
       if (data.code !== 200) {
         return this.$message.error("鐢ㄦ埛鍒楄〃璇锋眰閿欒");
@@ -409,7 +373,7 @@
       this.usercount = data.count;
     },
     // 瑙掕壊琛ㄨ姹�
-    async getRole() {
+    async getRole () {
       const data = await select_Role_ByPageAndCount(this.listData);
       if (data.code !== 200) {
         return this.$message.error("鐢ㄦ埛瑙掕壊璇锋眰閿欒");
@@ -418,7 +382,7 @@
       this.count = data.count;
     },
   },
-  created() {
+  created () {
     this.getMenuTree();
   },
 };

--
Gitblit v1.9.3