mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-31 18:28:44 +08:00 
			
		
		
		
	update: 重构用户管理部门回显方法
This commit is contained in:
		| @@ -332,26 +332,24 @@ const getPostOptions = async () => { | |||||||
|   const res = await getSimplePostList() |   const res = await getSimplePostList() | ||||||
|   postOptions.value.push(...res) |   postOptions.value.push(...res) | ||||||
| } | } | ||||||
| const dataFormater = (val) => { | const dataFormater = computed(() => (deptId: number) => deptFormater(deptOptions.value, deptId)) | ||||||
|   return deptFormater(deptOptions.value, val) |  | ||||||
| } |  | ||||||
| //部门回显 | //部门回显 | ||||||
| const deptFormater = (ary, val: any) => { | const deptFormater = (arr: Tree[], deptId: number) => { | ||||||
|   var o = '' |   let deptName = '' | ||||||
|   if (ary && val) { |   if (arr && deptId) { | ||||||
|     for (const v of ary) { |     for (const item of arr) { | ||||||
|       if (v.id == val) { |       if (item.id === deptId) { | ||||||
|         o = v.name |         deptName = item.name | ||||||
|         if (o) return o |         break | ||||||
|       } else if (v.children?.length) { |       } | ||||||
|         o = deptFormater(v.children, val) |       if (item.children) { | ||||||
|         if (o) return o |         deptName = deptFormater(item.children, deptId) ?? '' | ||||||
|  |         break | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return o |  | ||||||
|   } else { |  | ||||||
|     return val |  | ||||||
|   } |   } | ||||||
|  |   return deptName | ||||||
| } | } | ||||||
|  |  | ||||||
| // 设置标题 | // 设置标题 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999