Prechádzať zdrojové kódy

fix: 系统消息修复编辑不可编辑

qindao 1 rok pred
rodič
commit
77b76d4d04

+ 66 - 52
src/views/message/sysnotion-config/SysnotionConfig.vue

@@ -4,21 +4,20 @@
       <div @click="rollback()"
         ><img src="@/views/message/reportmessage/img/rollback.png" />返回</div
       >
-      <span v-if="!isDisabled">新建系统通知</span>
-      <span v-else>查看系统通知</span>
+      <span >{{ disabled ? '新建' : '查看'}}系统通知</span>
     </div>
     <div class="content">
       <div class="left">
         <!-- 基本配置 -->
         <BasicInfo ref="basicInfoRef" :data-soure="ruleForm" :is-disabled="isDisabled" />
         <!-- 内容配置区域 -->
-        <ContentConfig ref="contentConfigRef" :data-soure="ruleForm" :is-disabled="isDisabled" />
+        <ContentConfig ref="contentConfigRef" :data-soure="ruleForm" :is-disabled="isDisabled" :key="initKey"/>
         <!-- 按钮区域 -->
-        <div class="btns" v-if="!isDisabled">
+        <div class="btns" v-if="disabled">
           <div style="position: absolute; right: 0; bottom: 0">
             <el-button @click="onCancel">取消</el-button>
             <el-button @click="onSave">暂存</el-button>
-            <el-button type="primary" @click="submitForm">确定</el-button>
+            <el-button type="primary" @click="submitForm">确定发布</el-button>
           </div>
         </div>
       </div>
@@ -30,7 +29,7 @@
 
 <script lang="ts" setup>
   import { useRoute, useRouter } from 'vue-router';
-  import { ref, reactive, onMounted } from 'vue';
+  import { ref, reactive, onMounted, computed } from 'vue';
   import { storeToRefs } from 'pinia';
   import { ElMessage, ElMessageBox } from 'element-plus';
   import { useUserStore } from '@/store/modules/user';
@@ -40,12 +39,20 @@
     updateSystemMessage,
     viewSystemMessage,
   } from '@/api/message/sysnotion-config';
-  import { RuleFormView, MessageTypeEnum, ContentTypeEnum, RuleFormAdd, SysMessageStatus } from './type';
+  import {
+    RuleFormView,
+    MessageTypeEnum,
+    ContentTypeEnum,
+    RuleFormAdd,
+    SysMessageStatus,
+} from './type';
+  import { recipientTypeEnum } from '../systemNotifications/type';
   import BasicInfo from './compontents/BasicInfo.vue';
   import ContentConfig from './compontents/ContentConfig.vue';
   import RightCard from './compontents/RightCard.vue';
 
   const isDisabled = ref<boolean>(false); // 是可编辑还是只查看状态
+  
   const useUser = useUserStore();
   const { info } = storeToRefs(useUser);
   const basicInfoRef = ref<InstanceType<typeof BasicInfo>>();
@@ -56,7 +63,7 @@
     bannerUrl: '',
     pushChannel: [],
     expirationTime: '',
-    recipientType: 1, // 默认全员 (FIXME:魔法数字)
+    recipientType: recipientTypeEnum.all, // 默认全员
     userGroupList: [],
     customUserList: [],
     introduction: '',
@@ -64,7 +71,7 @@
     content: '',
     contentUrl: '',
     operator: info.value.nickname,
-    status: SysMessageStatus.DRAFT
+    status: SysMessageStatus.DRAFT,
   });
 
   // 原始数据副本
@@ -78,27 +85,32 @@
   };
   const route = useRoute();
   const sysId = Number(route.query.id as string);
-
+  const viewModel = route.query.viewModel as string;
+  const initKey = ref(0)
+  const disabled = computed(() => !isDisabled.value || viewModel === 'edit');
+  
   /**
    * 获取当前系统配置信息
    */
   const fetchSystemMessage = async () => {
     // 首次暂存后切换到编辑模式,因为路由没有发生变化,组件也不会发生变化,
     // sysId会一直为undefined,但此时 ruleForm.id 是存在的
-    const messageId = sysId || ruleForm.id
+    const messageId = sysId || ruleForm.id;
 
     // 查看 或 编辑状态
     if (messageId) {
       isDisabled.value = true;
       const res = await viewSystemMessage(messageId);
-      if (res.status === SysMessageStatus.DRAFT) {
+      if (res.status === SysMessageStatus.DRAFT && viewModel === 'edit') {
         // 如果未发布,还是可以编辑的
         isDisabled.value = false;
+      } else {
+        isDisabled.value = true;
       }
-
       ruleForm.id = messageId;
+      initKey.value += 1;
       Object.entries(res).forEach(([key, value]) => {
-          ruleForm[key] = value;
+        ruleForm[key] = value;
       });
     }
   };
@@ -109,31 +121,34 @@
   const onCancel = () => {
     // TODO:比对数据。 暂时不上
     // const changes = compareData(ruleForm, originalData);
-    // console.log('Object.keys(changes): ', Object.keys(changes));
-
-    ElMessageBox.confirm(
-      '你填写的数据若未及时保存,离开页面后将会丢失',
-      '提示',
-      {
-        confirmButtonText: '确认取消',
-        cancelButtonText: '继续留在页面',
-        type: 'warning',
-      }
-    )
-    .then(() => {
-      router.push('/message/systemNotifications');
+
+    ElMessageBox.confirm('你填写的数据若未及时保存,离开页面后将会丢失', '提示', {
+      confirmButtonText: '确认取消',
+      cancelButtonText: '继续留在页面',
+      type: 'warning',
     })
-    .catch(() => {})
+      .then(() => {
+        router.push('/message/systemNotifications');
+      })
+      .catch(() => {});
   };
 
-
   /**
    * 暂存功能。 未正式发布之前,可继续编辑
    */
   const onSave = async () => {
-    // 基础配置信息。 
-    // FIXME: validate 返回了数据,不符合单一原则
-    const baseInfoData = await basicInfoRef.value?.validate();
+    try {
+      await saveSysData();
+    } catch (error) {
+      ElMessage.error(error as string);
+    }
+  };
+  const saveSysData = async() => {
+    // 基础配置信息。
+    const isValidSuccess = await basicInfoRef.value?.validate();
+    const baseInfoData = await basicInfoRef.value?.buildFromData();
+    if (!isValidSuccess) return;
+
     // 内容配置信息。
     const contentConfigData = contentConfigRef.value?.buildFormdata();
 
@@ -147,33 +162,33 @@
 
     const messageId = sysId || ruleForm.id;
 
-    if (!messageId) { // 首次保存
+    if (!messageId) {
+      // 首次保存
       ruleForm.id = await addSystemMessage(params);
       ElMessage.success('暂存成功!');
-      await router.replace(`/message/sysnotion-config?id=${ruleForm.id}`)
+      await router.replace(`/message/sys-notification?id=${ruleForm.id}`);
       fetchSystemMessage();
-
-    } else { // 继续编辑
-      await updateSystemMessage(params)
+    } else {
+      // 继续编辑
+      await updateSystemMessage(params);
       ElMessage.success('编辑成功!');
     }
-  };
+  }
 
-  const submitForm = () => {
-    if (!ruleForm.id) {
-      ElMessage({
-        message: '暂存后才能下发!',
-        type: 'warning',
+  const submitForm = async() => {
+    try {
+      await saveSysData();
+      if (!ruleForm.id) return;
+      confirmReportConfig(ruleForm.id).then(() => {
+        ElMessage({
+          message: '下发成功!',
+          type: 'success',
+        });
+        router.push('/message/systemNotifications');
       });
-      return;
+    } catch (error) {
+      ElMessage.error(error as string);
     }
-    confirmReportConfig(ruleForm.id).then(() => {
-      ElMessage({
-        message: '下发成功!',
-        type: 'success',
-      });
-      router.push('/message/systemNotifications');
-    });
   };
 
   // 比对方法
@@ -187,7 +202,6 @@
     return diff;
   };
 
-
   onMounted(() => {
     fetchSystemMessage();
   });

+ 83 - 34
src/views/message/sysnotion-config/compontents/BasicInfo.vue

@@ -6,7 +6,6 @@
   <CardLayout title="基础配置" :isShowWraning="false" :mandatory="false">
     <el-form
       ref="ruleFormRef"
-      style="max-width: 600px"
       label-width="auto"
       :model="ruleForm"
       :rules="formRules"
@@ -14,7 +13,7 @@
       class="el-form-outer"
     >
       <el-form-item label="消息样式: " prop="messageType">
-        <el-radio-group v-model="ruleForm.messageType" :disabled="isDisabled">
+        <el-radio-group v-model="ruleForm.messageType" :disabled="!disabled">
           <el-radio :value="item.value" v-for="item in messageTypeOptions" :key="item.value"
             >{{ item.label }}
           </el-radio>
@@ -26,7 +25,7 @@
           placeholder="请输入20字以内的消息标题"
           maxlength="20"
           show-word-limit
-          :disabled="isDisabled"
+          :disabled="!disabled"
         />
       </el-form-item>
       <el-form-item
@@ -34,19 +33,23 @@
         prop="bannerUrl"
         v-if="ruleForm.messageType === MessageTypeEnum.BANNER"
       >
-        <img v-if="ruleForm.bannerUrl" :src="ruleForm.bannerUrl" class="avatar" />
         <el-upload
-          v-else
-          class="avatar-uploader"
+          ref="upload"
+          v-model:file-list="fileList"
           :action="actionUrl"
           :headers="getHeaders()"
           :data="{ bizType: 'PUSH_MESSAGE' }"
-          :show-file-list="false"
           :on-success="handleAvatarSuccess"
           :before-upload="beforeAvatarUpload"
+          :limit="1"
+          list-type="picture-card"
+          :on-exceed="handleExceed"
+          :on-preview="handlePictureCardPreview"
+          :disabled="!disabled"
         >
           <el-icon class="avatar-uploader-icon"><Plus /></el-icon>
         </el-upload>
+        <span class="tip-message">支持格式:.jpg、.jpeg、.png,文件不超过 20MB,建议上传 4:3 比例的图片!</span>
       </el-form-item>
 
       <el-form-item label="推送渠道: " prop="pushChannel">
@@ -56,7 +59,7 @@
             :key="item.value"
             :value="item.value"
             :label="item.label"
-            :disabled="isDisabled"
+            :disabled="!disabled"
           />
         </el-checkbox-group>
       </el-form-item>
@@ -67,24 +70,30 @@
           placeholder="请选择失效时间"
           format="YYYY/MM/DD hh:mm:ss"
           value-format="YYYY-MM-DD hh:mm:ss"
-          :disabled="isDisabled"
+          :disabled="!disabled"
+          :disabled-date="disabledDate"
         />
+        <span class="tip-message">请注意:超过该日期后,【APP/PC 主页】将不再弹出消息!</span>
       </el-form-item>
       <PushObject
         ref="childFromRef"
         :recipientType="ruleForm.recipientType"
         :userGroupList="ruleForm.userGroupList"
         :customUserList="ruleForm.customUserList"
-        :disabled="isDisabled"
+        :disabled="!disabled"
       />
     </el-form>
   </CardLayout>
+  <el-dialog v-model="dialogVisible">
+    <img w-full :src="dialogImageUrl" alt="Preview Image" />
+  </el-dialog>
 </template>
 
 <script setup lang="ts">
-  import { ref, watch, computed, unref } from 'vue';
-  import type { FormInstance, FormProps, FormRules, UploadProps } from 'element-plus';
-  import { ElMessage } from 'element-plus';
+import { ref, watch, computed, unref } from 'vue'
+  import { useRoute } from 'vue-router'
+  import type { FormInstance, FormProps, FormRules, UploadProps, UploadUserFile, UploadInstance, UploadRawFile } from 'element-plus';
+  import { ElMessage, genFileId } from 'element-plus';
   import { Plus } from '@element-plus/icons-vue';
   import PushObject from '../../components/PushObject.vue';
   import CardLayout from './CardLayout.vue';
@@ -93,6 +102,7 @@
   import urlJoin from 'url-join';
   import { useGlobSetting } from '@/hooks/setting';
   import { getHeaders } from '@/utils/http/axios';
+  import { isEmpty } from 'lodash-es';
 
   const { urlPrefix } = useGlobSetting();
   interface Props {
@@ -100,6 +110,8 @@
     isDisabled: boolean;
   }
   const props = defineProps<Props>();
+  const route = useRoute(); 
+  const disabled = computed(() => props.isDisabled === false || route.query.viewModel === 'edit')
   const labelPosition = ref<FormProps['labelPosition']>('left');
   const childFromRef = ref<InstanceType<typeof PushObject>>();
   const actionUrl = computed(() => {
@@ -130,12 +142,21 @@
     userGroupList: [],
     customUserList: [],
   });
+  const fileList = ref<UploadUserFile[]>([]);
 
   watch(
     () => props.dataSoure,
     (value) => {
       if (value) {
         ruleForm.value = { ...value };
+        if (!isEmpty(value.bannerUrl)) {
+          fileList.value = [
+            {
+              name: '',
+              url:  value.bannerUrl
+            },
+          ]
+        }
       }
     },
     {
@@ -150,45 +171,69 @@
     if (!ruleFormRef.value) return;
     try {
       const isSuccess = await ruleFormRef.value.validate();
-      if (isSuccess) {
-        const childValue = childFromRef.value!.getChildValue();
-        childFromRef.value!.submitForm().then((res) => {
-          isValidate.value = res;
-        });
-
-        const basicInfo = { ...unref(ruleForm) } as RuleFormAdd;
-
-        if (childValue) {
-          basicInfo.recipientType = childValue.recipientType!;
-          basicInfo.userGroupList = childValue.userGroupList!;
-          basicInfo.customUserList = childValue.customUserList!;
-        }
-        return basicInfo;
-      }
+      return isSuccess;
     } catch (error) {
       ElMessage.error('请完善信息填写');
       throw error;
     }
   };
 
+
   const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
     // 注意,这里 response 是 没有被拦截处理
     ruleForm.value.bannerUrl = response.data.url;
-    console.log(ruleForm.value);
+    
+
   };
 
+  // 上传前限制
   const beforeAvatarUpload: UploadProps['beforeUpload'] = (rawFile) => {
-    if (!['image/jpeg', 'image/png'].includes(rawFile.type)) {
-      ElMessage.error('Avatar picture must be JPG format!');
+    if (!['image/jpeg', 'image/png', 'image/jpg'].includes(rawFile.type)) {
+      ElMessage.error('文件格式仅支持:.jpg, .jpeg, .png');
       return false;
-    } else if (rawFile.size / 1024 / 1024 > 5) {
-      ElMessage.error('Avatar picture size can not exceed 2MB!');
+    } else if (rawFile.size / 1024 / 1024 > 20) {
+      ElMessage.error('文件不支持超过 20MB!');
       return false;
     }
     return true;
   };
 
-  defineExpose({ validate });
+  // 图片预览
+  const dialogImageUrl = ref('')
+  const dialogVisible = ref(false)
+  const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
+    dialogImageUrl.value = uploadFile.url!
+    dialogVisible.value = true
+  }
+
+  const upload = ref<UploadInstance>()
+  const handleExceed: UploadProps['onExceed'] = (files) => {
+    upload.value!.clearFiles()
+    const file = files[0] as UploadRawFile
+    file.uid = genFileId()
+    upload.value!.handleStart(file)
+  }
+
+  const buildFromData = () => {
+    const childValue = childFromRef.value!.getChildValue();
+    childFromRef.value!.submitForm().then((res) => {
+      isValidate.value = res;
+    });
+
+    const basicInfo = { ...unref(ruleForm) } as RuleFormAdd;
+    if (childValue) {
+      basicInfo.recipientType = childValue.recipientType!;
+      basicInfo.userGroupList = childValue.userGroupList!;
+      basicInfo.customUserList = childValue.customUserList!;
+    }
+    return basicInfo;
+  };
+
+  const disabledDate = (time: Date) => {
+    return time.getTime() < Date.now()
+  }
+
+  defineExpose({ validate, buildFromData });
 </script>
 
 <style scoped lang="scss">
@@ -217,4 +262,8 @@
     height: 58px;
     text-align: center;
   }
+
+  .tip-message {
+    margin-left: 20px;
+  }
 </style>

+ 30 - 32
src/views/message/sysnotion-config/compontents/ContentConfig.vue

@@ -20,7 +20,7 @@
           :rows="5"
           maxlength="500"
           show-word-limit
-          :disabled="isDisabled"
+          :disabled="!disabled"
         />
       </el-form-item>
 
@@ -40,7 +40,7 @@
         <el-input
           v-model="ruleForm.contentUrl"
           placeholder="请将链接地址粘贴到此处"
-          :disabled="isDisabled"
+          :disabled="!disabled"
         />
       </el-form-item>
       <el-form-item
@@ -48,21 +48,18 @@
         prop="content"
         v-if="ruleForm.contentType === ContentTypeEnum.RICHTEXT"
       >
-        <div style="border: 1px solid #ccc">
+        <div class="editor-wrapper" style="border: 1px solid #ccc">
           <Toolbar
             style="border-bottom: 1px solid #ccc"
             :editor="editorRef"
             :defaultConfig="toolbarConfig"
           />
           <Editor
+            id="editor"
             style="height: 500px; overflow-y: hidden"
-            v-model="valueHtml"
+            v-model="ruleForm.content"
             :defaultConfig="editorConfig"
             @onCreated="handleCreated"
-            @onChange="handleChange"
-            @onDestroyed="handleDestroyed"
-            @onFocus="handleFocus"
-            @onBlur="handleBlur"
           />
         </div>
       </el-form-item>
@@ -74,7 +71,8 @@
 </template>
 
 <script setup lang="ts">
-  import { onBeforeUnmount, ref, shallowRef, watch } from 'vue';
+  import { onBeforeUnmount, ref, shallowRef, watch, computed } from 'vue';
+  import { useRoute } from 'vue-router';
   import type { FormProps } from 'element-plus';
   import '@wangeditor/editor/dist/css/style.css'; // 引入 css
   import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
@@ -89,8 +87,11 @@
     isDisabled: boolean;
   }
   const props = defineProps<Props>();
+  const route = useRoute();
   const labelPosition = ref<FormProps['labelPosition']>('left');
   const userStore = useUserStore();
+  const disabled = computed(() => props.isDisabled === false || route.query.viewModel === 'edit')
+  
 
   /**
    * 表单相关操作
@@ -119,9 +120,6 @@
           operator,
           contentUrl,
         };
-        if (content) {
-          valueHtml.value = content;
-        }
       }
     },
     {
@@ -133,6 +131,7 @@
   /********************* 富文本区域配置与方法 **********************/
   // 编辑器实例,必须用 shallowRef
   const editorRef = shallowRef();
+
   // 内容 HTML
   const valueHtml = ref();
   // 排除工具栏选项
@@ -144,11 +143,13 @@
       'uploadVideo',
       'codeBlock', // 代码块
       'emotion', // 表情
+      'fullScreen'
     ],
   };
   const editorConfig: Partial<IEditorConfig> = {
     placeholder: '请输入内容...',
     MENU_CONF: {},
+   
   };
 
   editorConfig.MENU_CONF!['uploadImage'] = {
@@ -181,7 +182,7 @@
     timeout: 10 * 1000, // 5 秒
     // 上传之前触发
     onBeforeUpload(file) {
-      console.log('file: ', file);
+       
       return file;
       // 可以 return
       // 1. return file 或者 new 一个 file ,接下来将上传
@@ -190,19 +191,19 @@
     // 上传进度的回调函数
     onProgress(progress: number) {
       // progress 是 0-100 的数字
-      console.log('progress', progress);
+      
     },
     // 单个文件上传成功之后
     onSuccess(file: File, res: any) {
-      console.log(`${file.name} 上传成功`, res);
+      
     },
     // 单个文件上传失败
     onFailed(file: File, res: any) {
-      console.log(`${file.name} 上传失败`, res);
+      
     },
     // 上传错误,或者触发 timeout 超时
     onError(file: File, err: any, res: any) {
-      console.log(`${file.name} 上传出错`, err, res);
+      
     },
   };
 
@@ -214,29 +215,26 @@
   });
 
   const handleCreated = (editor) => {
-    editorRef.value = editor;
-  };
-  const handleChange = (editor) => {
-    // console.log('change:', editor.children)
-  };
-  const handleDestroyed = (editor) => {
-    console.log('destroyed', editor);
-  };
-  const handleFocus = (editor) => {
-    // console.log('focus', editor)
-  };
-  const handleBlur = (editor) => {
-    console.log('blur', editor);
+    editorRef.value = editor // 创建富文本编辑器
+    if(!disabled.value){
+      editorRef.value.disable()  //禁用
+    } else {
+      editorRef.value.enable()  //启用
+    }
   };
 
   const buildFormdata = () => {
     return {
       ...ruleForm.value,
-      content: valueHtml.value,
+      // content: valueHtml.value,
     };
   };
 
   defineExpose({ buildFormdata });
 </script>
 
-<style scoped lang="scss"></style>
+<style scoped lang="scss">
+  .editor-wrapper{
+    z-index: 90;
+  }
+</style>

+ 15 - 6
src/views/message/systemNotifications/components/systemNotificationTable.vue

@@ -46,10 +46,13 @@
       <template #default="scope">
         <div class="operation">
           <el-tooltip effect="light" content="查看" placement="bottom">
-            <img src="../img/view.png" @click="handleView(scope.row.id)" />
+            <img src="@/views/message/alarmMessages/img/view.png" @click="handleView(scope.row.id, 'view')" />
           </el-tooltip>
+           <el-tooltip class="box-item" effect="light" content="编辑" placement="bottom" v-if="scope.row.status === PushStatusEnum.PEDDING">
+              <img src="@/views/message/alarmMessages/img/edit.png" @click="handleView(scope.row.id, 'edit')" />
+            </el-tooltip>
           <el-tooltip effect="light" content="删除" placement="bottom">
-            <img src="../img/delete.png" @click="handleDelete(scope.row.id)" />
+            <img src="@/views/message/alarmMessages/img/delete.png" @click="handleDelete(scope.row.id)" />
           </el-tooltip>
         </div>
       </template>
@@ -92,24 +95,26 @@
 <script lang="ts" setup>
   import { ref, onMounted } from 'vue';
   import { useRouter } from 'vue-router';
-  import { pushChannelMapping, recipientTypeMapping } from '../type';
+  import { pushChannelMapping, recipientTypeMapping, PushStatusEnum } from '../type';
   import SearchBar from './SearchBar.vue';
   import { storeToRefs } from 'pinia';
   import useSysNotion from '../store/index';
   import { deleteSystemMessage } from '@/api/message/system-notifications';
   import { ElMessage } from 'element-plus';
+
   const sysNotion = useSysNotion();
   const { total, page, pagesize, sysNotionData } = storeToRefs(sysNotion);
   const { getSysNotion } = sysNotion;
   const deleteDialog = ref(false);
   const router = useRouter();
+  type ViewModel = 'view' | 'edit';
 
   const createNotification = () => {
-    router.push('/message/sysnotion-config');
+    router.push('/message/sys-notification-config');
   };
 
-  const handleView = (id: number) => {
-    router.push(`/message/sysnotion-config?id=${id}`);
+  const handleView = (id: number, model: ViewModel ) => {
+    router.push(`/message/sys-notification-config?id=${id}&viewModel=${model}`);
   };
   const deleteId = ref<number>(0);
   const handleDelete = (id: number) => {
@@ -179,6 +184,10 @@
     img + img {
       margin-left: 20px;
     }
+
+    button {
+     margin-: 20px;
+    }
   }
 
   .emptyDiv {

+ 1 - 1
src/views/message/systemNotifications/store/index.ts

@@ -15,7 +15,7 @@ export const useSysNotion = defineStore('sys-notion', () => {
       pageSize: pagesize.value,
     };
     if (content.value) {
-      params.content = content.value;
+      params.queryParam	 = content.value;
     }
     return getSystemMessageList(params).then((res) => {
       return res;

+ 14 - 5
src/views/system/user/user.vue

@@ -1,7 +1,11 @@
 <template>
   <div class="user-page">
-    <SearchForm ref="searchFormRef" :departmentList="departmentList" :roleData="roleData"
-      @get-table-data="onSearchCommit" @reset-form="onResetForm" />
+    <SearchForm ref="searchFormRef" 
+      :departmentList="departmentList" 
+      :roleData="roleData"
+      @get-table-data="onSearchCommit" 
+      @reset-form="onResetForm" 
+      />
     <el-card>
       <template #header>
         <el-space align="center">
@@ -32,7 +36,10 @@
         </el-space>
       </template>
 
-      <el-table height="calc(100vh - 340px)" :data="userList">
+      <el-table height="calc(100vh - 340px)" 
+        :data="userList"  
+        row-key="id" 
+        >
         <el-table-column label="工号" prop="staffNo">
           <template #default="scope">
             <div>
@@ -141,6 +148,7 @@
   import CreateAdminDrawer from './CreateAdminDrawer.vue';
   import editIcon from '@/assets/images/reportmessage/edit.png';
   import deleteIcon from '@/assets/images/reportmessage/delete.png';
+  import { SYS_TENANT_ID } from '@/utils/useTargetTenantIdSetting';
 
   const userStore = useUserStore();
   const { getUserInfo } = storeToRefs(userStore);
@@ -164,8 +172,9 @@
 
   // 当前用户类型
   const currrentRoleType = getUserInfo.value.roleType;
+  const currrentTenantId = getUserInfo.value.tenantId;
   // 是否拥有添加租户管理人员权限,条件:1.系统用户,2.选择租户切换到租户选项
-  const isCanAddTenant = Number(currrentRoleType) !== RoleTypeEnum.TENANT_ADMIN;
+  const isCanAddTenant = Number(currrentRoleType) !== RoleTypeEnum.TENANT_ADMIN && currrentTenantId === SYS_TENANT_ID;
   const openAddSingleDrawer = () => {
     drawerTitle.value = '添加用户';
     if (isSysTenant) {
@@ -234,7 +243,7 @@
 
   /* 是否能重置密码 */
   const visibleRestPassBtn = (type: RoleTypeEnum): boolean => {
-    if (isSysTenant || (!isSysTenant && type !== RoleTypeEnum.TENANT_ADMIN)) {
+    if (isSysTenant || (!isSysTenant && type !== RoleTypeEnum.TENANT_ADMIN) || currrentTenantId === SYS_TENANT_ID) {
       return true;
     }
     return false;