“ystl_myq” преди 2 седмици
родител
ревизия
f7f06f6e99

+ 13 - 8
src/api/department.ts

@@ -36,26 +36,31 @@ export const treeDept = ref([]);
 export const postListTreeWithUserApi = async () => {
   const res = await postListTreeWithUser();
   treeDept.value = transformData(res.data);
+  console.log("res,data", res.data);
   console.log("过滤的数据.", treeDept.value);
 };
 const transformData = data => {
+  // 基本的转换逻辑
   return data.map(item => {
+    // 初始化一个转换后的项目
     const transformedItem = {
-      userName: item.userName || item.deptName,
-      userCode: item.userCode || item.deptCode,
-      children: []
+      userName: item.deptName || item.userName, // 使用 deptName 或 userName
+      userCode: item.deptCode || item.userCode, // 使用 deptCode 或 userCode
+      children: [] // 用于存储子部门和用户数据
     };
 
-    if (item.childrenRes) {
-      transformedItem.children = transformData(item.childrenRes);
+    // 递归处理子部门数据(childrenRes)
+    if (item.childrenRes && Array.isArray(item.childrenRes)) {
+      transformedItem.children.push(...transformData(item.childrenRes)); // 合并所有子部门
     }
 
-    if (item.childrenUserRes) {
+    // 处理当前部门的用户数据(childrenUserRes)
+    if (item.childrenUserRes && Array.isArray(item.childrenUserRes)) {
       item.childrenUserRes.forEach(user => {
+        // 将每个用户添加到 children 数组
         transformedItem.children.push({
           userName: user.userName,
-          userCode: user.userCode,
-          children: []
+          userCode: user.userCode
         });
       });
     }

+ 13 - 1
src/views/background/framework/proson/prosonDepartment.vue

@@ -222,7 +222,7 @@ watch(realName, val => {
       >
         <template #default="{ node }">
           <div class="flex-1 flex justify-between items-center">
-            <span>{{ node.label }}</span>
+            <div class="w-[150px] ellipsis">{{ node.label }}</div>
             <el-dropdown trigger="click" @click.stop>
               <span>
                 <el-icon>
@@ -326,6 +326,18 @@ watch(realName, val => {
   padding: 10px 20px;
 }
 
+.ellipsis {
+  /* 防止文本换行 */
+  overflow: hidden;
+
+  /* 隐藏超出部分 */
+  text-overflow: ellipsis;
+  // border: 1px solid red;
+  white-space: nowrap;
+
+  /* 用省略号表示被截断的部分 */
+}
+
 // ::v-deep .el-dropdown {
 //   line-height: 1;
 // }

+ 12 - 14
src/views/background/framework/users/components/addUsers.vue

@@ -47,16 +47,9 @@ const postAddUserGroupApi = async () => {
   }
 };
 const handleClose = () => {
+  formRef.value.clearValidate(); // 清除验证错误
+  formRef.value.resetFields(); // 重置表单字段
   dialogVisibleAdd.value = false;
-  // ElMessageBox.confirm("确认关闭弹窗吗?")
-  //   .then(() => {
-  //     ElMessage({
-  //       message: "已关闭"
-  //     });
-  //   })
-  //   .catch(() => {
-  //     // catch error
-  //   });
 };
 // 角色数据
 
@@ -77,11 +70,11 @@ const changeRoles = () => {
 
 // 添加部门保存
 const saveDepartment = () => {
-  // formRef.value.validate(valid => {
-  //   if (valid) {
-  //   }
-  // });
-  postAddUserGroupApi();
+  formRef.value.validate(valid => {
+    if (valid) {
+      postAddUserGroupApi();
+    }
+  });
 };
 const open = item => {
   if (item) {
@@ -92,6 +85,11 @@ const open = item => {
     form.groupName = item.groupName;
     dialogForm.value = false;
   } else {
+    Object.assign(form, {
+      groupName: "",
+      hospitalCode: "",
+      leaderCode: ""
+    });
     dialogTitle.value = "新建用户组";
     form.groupName = "";
     dialogForm.value = true;

+ 21 - 3
src/views/background/framework/users/components/editPerson.vue

@@ -3,6 +3,7 @@ import { ref, reactive } from "vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
 import { postUpdateGroupByCode } from "@/api/userGroup";
+import { getLeaderList } from "@/api/userSetting";
 const drawer = ref(false);
 const formRef = ref();
 const emit = defineEmits(["handleClick"]);
@@ -54,6 +55,14 @@ function confirmClick() {
     }
   });
 }
+// 获取负责人
+const leader = ref([]);
+const getLeaderListApi = async () => {
+  const { code, data } = await getLeaderList();
+  if (code == 200) {
+    leader.value = data;
+  }
+};
 const open = row => {
   if (row) {
     console.log("11111", row);
@@ -63,6 +72,7 @@ const open = row => {
     formLabelAlign.hospitalCode = row.hospitalCode;
   }
   drawer.value = true;
+  getLeaderListApi();
 };
 const editShow = ref(true);
 // 编辑
@@ -108,10 +118,18 @@ const timer = ref("");
               />
             </el-form-item>
             <el-form-item label="用户组负责人" label-position="top">
-              <el-input
+              <!-- <el-input v-model="formLabelAlign.leaderCode" :disabled="disabledValue" /> -->
+              <el-select
                 v-model="formLabelAlign.leaderCode"
-                :disabled="disabledValue"
-              />
+                placeholder="请选择"
+              >
+                <el-option
+                  v-for="item in leader"
+                  :key="item.userCode"
+                  :label="item.userName"
+                  :value="item.userCode"
+                />
+              </el-select>
             </el-form-item>
           </el-form>
         </div>

+ 7 - 2
src/views/evaluate/children/change/mould/message.vue

@@ -159,6 +159,7 @@ const postListTreeWithUserApi = async () => {
   const { data, code } = await getTemplateInfoList(templateparams);
   resTmp.value = data.records;
   treeDept.value = [];
+  console.log("1111", res.data);
   treeDept.value = transformData(res.data);
 };
 postListTreeWithUserApi();
@@ -255,14 +256,18 @@ const updateAssessmentApi = async () => {
                   class="cursor-pointer ml-4 text-xs pt-2"
                   @click="decreaseYear"
                 >
-                  <el-icon><DArrowLeft /></el-icon>
+                  <el-icon>
+                    <DArrowLeft />
+                  </el-icon>
                 </div>
                 <div>{{ yearTime }}</div>
                 <div
                   class="cursor-pointer mr-4 text-xs pt-2"
                   @click="increaseYear"
                 >
-                  <el-icon><DArrowRight /></el-icon>
+                  <el-icon>
+                    <DArrowRight />
+                  </el-icon>
                 </div>
               </div>
               <div