buhuazhen
15 小时以前 98a53588c381bdcdea111cb1deddc06f6c7f1c28
src/views/system/user/index.vue
@@ -507,6 +507,9 @@
   const userId = row.userId || ids.value
   getUser(userId).then(response => {
      form.value = response.data
      form.value.deptId = getMatchedDeptId(
         response.deptId ?? response.data?.deptId ?? response.data?.dept?.id
      )
      postOptions.value = response.posts
      roleOptions.value = response.roles
      form.value.postIds = response.postIds
@@ -517,6 +520,27 @@
   })
}
function getMatchedDeptId(rawDeptId) {
   if (rawDeptId === undefined || rawDeptId === null || !Array.isArray(enabledDeptOptions.value)) {
      return rawDeptId
   }
   const target = String(rawDeptId)
   const stack = [...enabledDeptOptions.value]
   while (stack.length) {
      const node = stack.shift()
      if (!node) {
         continue
      }
      if (String(node.id) === target) {
         return node.id
      }
      if (Array.isArray(node.children) && node.children.length) {
         stack.push(...node.children)
      }
   }
   return rawDeptId
}
/** 提交按钮 */
function submitForm() {
   proxy.$refs["userRef"].validate(valid => {