Browse Source

fix: bug fixed

haifeng.zhang 6 days ago
parent
commit
63f3e6c4cf

+ 11 - 0
src/api/roles.ts

@@ -1,3 +1,11 @@
+/*
+ * @Author: zhanghaifeng
+ * @Date: 2024-11-04 16:39:08
+ * @LastEditors: zhanghaifeng
+ * @LastEditTime: 2024-11-07 13:56:39
+ * @Description:
+ * @FilePath: /hospital-project/src/api/roles.ts
+ */
 import { http } from "@/utils/http";
 
 type pageRole = {
@@ -30,6 +38,9 @@ export const postAddRole = data => {
 export const postUpdateRole = data => {
   return http.request<pageRole>("post", "/sysRole/updateRole", { data });
 };
+export const postUpdateRoleName = data => {
+  return http.request<pageRole>("post", "/sysRole/updateRoleName", { data });
+};
 // 查询角色下用户
 export const postPageUserByRole = data => {
   return http.request<pageRoleList>("post", "/sysRole/pageUserByRole", {

+ 3 - 1
src/store/modules/user.ts

@@ -45,10 +45,12 @@ export const useUserStore = defineStore({
       return new Promise<UserResult>((resolve, reject) => {
         getLogin(data)
           .then(data => {
-            if (data) {
+            if (data.code && data.code === 200) {
               // token超时时间
               setToken(data.data);
               resolve(data);
+            } else {
+              reject(data.msg);
             }
           })
           .catch(error => {

+ 4 - 2
src/views/background/framework/proson/components/newDepartment.vue

@@ -71,18 +71,20 @@ const saveDepartment = () => {
   });
 };
 const open = node => {
+  console.log(node, "-------");
   dialogVisibleAdd.value = true;
   postUserListApi();
-  postListTreeApi();
   if (node) {
     // form.leader
     form.deptName = "";
     form.deptCode = "";
     form.hospitalCode = "";
     form.leader = "";
-    form.parentCode = "";
     optiones.parentOptions = [];
     optiones.parentOptions.push(node.data);
+    form.parentCode = node.data.deptCode;
+  } else {
+    postListTreeApi();
   }
 };
 // 添加子部门数据

+ 2 - 2
src/views/background/framework/roles/components/addRole.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts">
 import { ref, reactive } from "vue";
 import { ElMessageBox, ElMessage } from "element-plus";
-import { postAddRole, postUpdateRole } from "@/api/roles";
+import { postAddRole, postUpdateRole, postUpdateRoleName } from "@/api/roles";
 const emit = defineEmits(["handleClick"]);
 const dialogVisibleAdd = ref(false);
 const dialogTitle = ref("新增");
@@ -14,7 +14,7 @@ const postAddRoleApi = async () => {
   const res =
     dialogTitle.value == "新增"
       ? await postAddRole(form)
-      : await postUpdateRole(form);
+      : await postUpdateRoleName(form);
   if (res.code === 200) {
     emit("handleClick");
     ElMessage({

+ 0 - 1
src/views/login/index.vue

@@ -92,7 +92,6 @@ const onLogin = async (formEl: FormInstance | undefined) => {
         .catch(err => {
           loading.value = false;
           message(err, { type: "error" });
-          console.log("登录失败", err);
           return fields;
         });
     } else {

+ 11 - 11
src/views/password/index.vue

@@ -48,17 +48,17 @@ const UpdatePasswordApi = async () => {
 };
 const rules = {
   oldPwd: [
-    { required: true, message: "请输入密码", trigger: "blur" },
-    {
-      validator: (rule, value, callback) => {
-        if (value !== passWord.value) {
-          callback(new Error("旧密码不正确"));
-        } else {
-          callback();
-        }
-      },
-      trigger: "blur"
-    }
+    { required: true, message: "请输入密码", trigger: "blur" }
+    // {
+    //   validator: (rule, value, callback) => {
+    //     if (value !== passWord.value) {
+    //       callback(new Error("旧密码不正确"));
+    //     } else {
+    //       callback();
+    //     }
+    //   },
+    //   trigger: "blur"
+    // }
   ],
   newPwd: [
     { required: true, message: "请输入 6 - 14 位密码", trigger: "blur" },