From 366612bd8e8b88d02a98edf508f96d7add23ff9f Mon Sep 17 00:00:00 2001
From: pengwei <2071057782@qq.com>
Date: 星期日, 27 四月 2025 16:03:38 +0800
Subject: [PATCH] 功能新增

---
 项目代码/client/src/views/tts/UserManagement/Usermanagement.vue |   60 ++++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 38 insertions(+), 22 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/UserManagement/Usermanagement.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/UserManagement/Usermanagement.vue"
index 33f9791..d988f4e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/UserManagement/Usermanagement.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/views/tts/UserManagement/Usermanagement.vue"
@@ -183,9 +183,7 @@
             <template #default="scope">
               <el-image
                 style="width: 70px; height: 70px"
-                :src="
-                  'http://115.159.85.185:9098' + scope.row.headImageUrl
-                "
+                :src="'http://115.159.85.185:9098' + scope.row.headImageUrl"
                 show-progress
                 :initial-index="4"
                 fit="cover"
@@ -202,7 +200,11 @@
             <template #default="scope">
               <el-switch
                 :disabled="
-                  scope.row.userName == 'admin' || scope.row.user_Id == '1'
+                  userInfo.userName == 'admin' || userInfo.roleId == '1'
+                    ? scope.row.userName == 'admin' || scope.row.user_Id == '1'
+                    : scope.row.userName == 'admin' ||
+                      scope.row.user_Id == '1' ||
+                      scope.row.userName != userInfo.userName
                 "
                 v-model="scope.row.enable"
                 :active-value="1"
@@ -223,17 +225,13 @@
                 size="small"
                 type="text"
                 @click="Edit(scope.row)"
-                :disabled="
-                  scope.row.userName == 'admin' || scope.row.user_Id == '1'
-                "
+                :disabled="scope.row.isdisabled"
                 >缂栬緫</el-button
               >
               <el-button
                 size="small"
                 type="text"
-                :disabled="
-                  scope.row.userName == 'admin' || scope.row.user_Id == '1'
-                "
+                :disabled="scope.row.isdisabled"
                 @click="Editpassword(scope.row)"
                 >淇敼瀵嗙爜</el-button
               >
@@ -241,9 +239,7 @@
                 size="small"
                 type="text"
                 @click="deletUser(scope.row)"
-                :disabled="
-                  scope.row.userName == 'admin' || scope.row.user_Id == '1'
-                "
+                :disabled="scope.row.isdisabled"
                 >鍒犻櫎</el-button
               >
             </template>
@@ -277,7 +273,11 @@
             <template #default="scope">
               <span
                 v-if="
-                  scope.row.roleName != '瓒呯骇绠$悊鍛�' || scope.row.roleId != '1'
+                  !(userInfo.userName == 'admin' || userInfo.roleId == '1'
+                    ? scope.row.userName == 'admin' || scope.row.user_Id == '1'
+                    : scope.row.userName == 'admin' ||
+                      scope.row.user_Id == '1' ||
+                      scope.row.userName != userInfo.userName)
                 "
                 @click="toDetail(scope.row)"
                 style="color: #4386ff; cursor: pointer"
@@ -290,7 +290,7 @@
             <template #default="scope">
               <el-switch
                 :disabled="
-                  scope.row.roleName == '瓒呯骇绠$悊鍛�' || scope.row.roleId == '1'
+                  !(userInfo.userName == 'admin' || userInfo.roleId == '1')
                 "
                 v-model="scope.row.enable"
                 :active-value="1"
@@ -304,7 +304,11 @@
             <template #default="scope">
               <span
                 v-if="
-                  scope.row.roleName != '瓒呯骇绠$悊鍛�' || scope.row.roleId != '1'
+                  !(userInfo.userName == 'admin' || userInfo.roleId == '1'
+                    ? scope.row.userName == 'admin' || scope.row.user_Id == '1'
+                    : scope.row.userName == 'admin' ||
+                      scope.row.user_Id == '1' ||
+                      scope.row.userName != userInfo.userName)
                 "
                 style="color: blue; font-size: 0.88rem; cursor: pointer"
                 @click="EditRole(scope.row)"
@@ -454,7 +458,7 @@
                 size="small"
               >
                 <el-option
-                  :disabled="item.roleId == 20"
+                  :disabled="item.roleId == 1"
                   v-for="item in groupOptions"
                   :key="item.roleId"
                   :label="item.roleName"
@@ -849,7 +853,7 @@
   id: undefined,
   username: "",
   phoneno: "",
-  roleid: 21,
+  roleid: 2,
   rolename: "",
   enable: 1,
   path: "",
@@ -895,6 +899,7 @@
 const dialogVisible = ref(false);
 const imgdialogVisible = ref(false);
 const dialogImageUrl = ref("");
+const userInfo = ref();
 //鐢ㄦ埛淇℃伅淇敼瀵嗙爜寮瑰嚭妗�
 const dialogVisible1 = ref(false);
 //鐢ㄦ埛瑙掕壊鏂板缓
@@ -981,7 +986,17 @@
     startDate: startTime,
     endDate: endTime,
   }).then((res) => {
-    tableData.value = res.data.items;
+    tableData.value = res.data.items.map((item) => {
+      return {
+        ...item,
+        isdisabled:
+          userInfo.value.userName == "admin" || userInfo.value.roleId == "1"
+            ? item.userName == "admin" || item.user_Id == "1"
+            : item.userName == "admin" ||
+              item.user_Id == "1" ||
+              item.userName != userInfo.value.userName,
+      };
+    });
     pageTotal.value = res.data.totalCount;
   });
 };
@@ -1074,7 +1089,7 @@
   formUser.value = {
     username: "",
     phoneno: "",
-    roleid: 21,
+    roleid: 2,
     rolename: "",
     enable: 1,
     path: "",
@@ -1157,7 +1172,6 @@
     dialogVisible.value = false;
     initData();
   });
-  console.log(val);
 };
 // 鐢ㄦ埛瑙掕壊鏄惁鍚敤
 const changeRoleSwitch = (val) => {
@@ -1409,15 +1423,16 @@
 const toDetail = (row) => {
   router.push({ name: "permission", state: { info: JSON.stringify(row) } });
 };
-
 onMounted(() => {
   initData();
   getRole();
+  userInfo.value = JSON.parse(localStorage.getItem("user"));
 });
 </script>
 <style lang="scss" scoped>
 .Usermanagement {
   display: flex;
+  flex-direction: column;
   background-color: #fff;
 
   .content {
@@ -1558,6 +1573,7 @@
     text-align: center;
   }
 }
+
 :deep(.hide .el-upload--picture-card) {
   display: none;
 }

--
Gitblit v1.9.3