Преглед на файлове

fix:用户列表里,科组长不展示“重置密码”按钮

刘洋 преди 2 години
родител
ревизия
2af00ed87e
променени са 2 файла, в които са добавени 39 реда и са изтрити 37 реда
  1. 0 7
      components.d.ts
  2. 39 30
      src/pages/user-manage/index.vue

+ 0 - 7
components.d.ts

@@ -8,15 +8,10 @@ export {}
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
     AButton: typeof import('ant-design-vue/es')['Button']
-    AButtonGroup: typeof import('ant-design-vue/es')['ButtonGroup']
-    ADropdownButton: typeof import('ant-design-vue/es')['DropdownButton']
     AForm: typeof import('ant-design-vue/es')['Form']
     AFormItem: typeof import('ant-design-vue/es')['FormItem']
     AInput: typeof import('ant-design-vue/es')['Input']
-    AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
     AInputPassword: typeof import('ant-design-vue/es')['InputPassword']
-    AMenu: typeof import('ant-design-vue/es')['Menu']
-    AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
     AModal: typeof import('ant-design-vue/es')['Modal']
     APopover: typeof import('ant-design-vue/es')['Popover']
     ARadio: typeof import('ant-design-vue/es')['Radio']
@@ -28,8 +23,6 @@ declare module '@vue/runtime-core' {
     ATooltip: typeof import('ant-design-vue/es')['Tooltip']
     AUpload: typeof import('ant-design-vue/es')['Upload']
     Block: typeof import('./src/components/block/index.vue')['default']
-    Button: typeof import('./src/components/button/index.vue')['default']
-    Form: typeof import('./src/components/form/index.vue')['default']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
     SvgIcon: typeof import('./src/components/svg-icon/index.vue')['default']

+ 39 - 30
src/pages/user-manage/index.vue

@@ -89,7 +89,7 @@
             </template>
           </template>
           <template v-else-if="column.dataIndex === 'courseCodes'">
-            {{record.courseCodes?.join('、')}}
+            {{ record.courseCodes?.join("、") }}
           </template>
           <template v-else-if="column.dataIndex === 'operation'">
             <div
@@ -107,6 +107,7 @@
                 >编辑</span
               >
               <span
+                v-if="record.role !== 'SECTION_LEADER'"
                 class="tw-cursor-pointer tw-p-2 tw-ml-1"
                 @click="onResetPwd(record)"
                 >重置密码
@@ -146,11 +147,11 @@
         <a-form-item label="角色" v-bind="validateInfos.role">
           <a-select v-model:value="userInfo.role" placeholder="请选择角色">
             <a-select-option value="SCHOOL_ADMIN">{{
-                ROLE.SCHOOL_ADMIN
-              }}</a-select-option>
+              ROLE.SCHOOL_ADMIN
+            }}</a-select-option>
             <a-select-option value="SECTION_LEADER">{{
-                ROLE.SECTION_LEADER
-              }}</a-select-option>
+              ROLE.SECTION_LEADER
+            }}</a-select-option>
           </a-select>
         </a-form-item>
         <a-form-item label="姓名" v-bind="validateInfos.name">
@@ -399,10 +400,16 @@ const columns: TableColumnType[] = [
     ellipsis: true,
   },
   { title: "角色", dataIndex: "roleName", align: "center", width: 120 },
-  { title: "科目代码", dataIndex: "courseCodes", align: "center", minWidth: 80 },
-  { title: "更新时间", dataIndex: "updateTime", width: 200, ellipsis: true },
+  {
+    title: "科目代码",
+    dataIndex: "courseCodes",
+    align: "center",
+    ellipsis: true,
+    minWidth: 120,
+  },
+  { title: "更新时间", dataIndex: "updateTime", width: 150, ellipsis: true },
   { title: "状态", dataIndex: "enable", align: "center", width: 80 },
-  { title: "操作", dataIndex: "operation", width: 240 },
+  { title: "操作", dataIndex: "operation", width: 200 },
 ];
 
 /** 用户列表信息 */
@@ -513,34 +520,36 @@ const onPutUser = () => {
         // @ts-ignore
         { pattern: /\d{11}/, message: "请填写正确的手机号" },
       ],
-      passwd: []
+      passwd: [],
     });
   } else {
     Object.assign(userRules, {
       loginName: [{ required: true, message: "请填写登录名" }],
     });
   }
-  validate().then((valid) => {
-    if (valid) {
-      const { role, course, schoolTableData, passwd,...info } = userInfo;
-      editUserInfoHttp({
-        ...info,
-        role,
-        passwd: role === "SECTION_LEADER" ? "" : passwd,
-        course: role === "SECTION_LEADER" ? course : "",
-      }).then(() => {
-        message.success(`${isEdit ? "修改" : "添加"}成功`);
-        queryUserList();
-        toggleAddUserModal(false);
-      });
-    }
-  }).catch(()=>{
-    if (userInfo.id) {
-      Object.assign(userRules, { schoolId: [], passwd: [] });
-    } else {
-      Object.assign(userRules, { ...addUserRules() });
-    }
-  });
+  validate()
+    .then((valid) => {
+      if (valid) {
+        const { role, course, schoolTableData, passwd, ...info } = userInfo;
+        editUserInfoHttp({
+          ...info,
+          role,
+          passwd: role === "SECTION_LEADER" ? "" : passwd,
+          course: role === "SECTION_LEADER" ? course : "",
+        }).then(() => {
+          message.success(`${isEdit ? "修改" : "添加"}成功`);
+          queryUserList();
+          toggleAddUserModal(false);
+        });
+      }
+    })
+    .catch(() => {
+      if (userInfo.id) {
+        Object.assign(userRules, { schoolId: [], passwd: [] });
+      } else {
+        Object.assign(userRules, { ...addUserRules() });
+      }
+    });
 };
 
 /** 导入用户 */