Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李宁
/
Activity
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2db8e81c
authored
Nov 24, 2025
by
李宁
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
0b2f302d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
13 deletions
channelBusiManage/public/static/file/order_tem.xlsx
channelBusiManage/public/static/file/rule_tem.xlsx
channelBusiManage/src/components/UserManagement.vue
channelBusiManage/public/static/file/order_tem.xlsx
0 → 100644
View file @
2db8e81
No preview for this file type
channelBusiManage/public/static/file/rule_tem.xlsx
0 → 100644
View file @
2db8e81
No preview for this file type
channelBusiManage/src/components/UserManagement.vue
View file @
2db8e81
...
...
@@ -327,9 +327,11 @@ export interface User {
accountType
?:
'1'
|
'2'
|
'3'
phone
?:
string
email
?:
string
status
:
'正常'
|
'禁用'
status
:
'1'
|
'0'
,
userType
?:
String
createTime
?:
string
creatorId
?:
string
creatorId
?:
string
,
areaId
?:
String
}
interface
Role
{
id
:
string
...
...
@@ -489,15 +491,34 @@ const handleOpenAddDialog = () => {
}
const
handleOpenEditDialog
=
(
row
)
=>
{
editingUser
.
value
=
row
console
.
log
(
'编辑用户数据:'
,
row
)
formData
.
value
=
{
username
:
row
.
userCode
,
realName
:
row
.
username
,
phone
:
row
.
phone
||
''
,
accountType
:
row
.
userType
+
''
,
organizationId
:
row
.
areaId
,
organizationId
:
row
.
areaId
+
''
,
roleId
:
row
.
roleId
,
isActive
:
row
.
status
===
1
}
console
.
log
(
'设置的组织ID:'
,
formData
.
value
.
organizationId
,
'类型:'
,
typeof
formData
.
value
.
organizationId
)
console
.
log
(
'组织数据:'
,
props
.
organizations
)
// 调试:打印组织数据中的ID和类型
const
debugOrgs
=
(
orgs
:
any
[],
depth
=
0
)
=>
{
orgs
.
forEach
(
org
=>
{
console
.
log
(
`组织ID:
${
org
.
id
}
, 类型:
${
typeof
org
.
id
}
, 名称:
${
org
.
name
}
`
)
if
(
org
.
children
)
debugOrgs
(
org
.
children
,
depth
+
1
)
})
}
debugOrgs
(
props
.
organizations
)
// 自动展开到选中组织的路径
if
(
row
.
areaId
)
{
expandToOrganization
(
row
.
areaId
+
''
)
}
isDialogOpen
.
value
=
true
}
const
handleAccountTypeChange
=
()
=>
{
...
...
@@ -527,6 +548,38 @@ const handleToggleExpand = (orgId: string) => {
organizationExpandedIds
.
value
.
add
(
orgId
)
}
}
// 展开到指定组织的路径
const
expandToOrganization
=
(
targetOrgId
:
string
)
=>
{
// 先清空展开状态
organizationExpandedIds
.
value
.
clear
()
// 查找目标组织的所有父级组织ID
const
findParentPath
=
(
orgs
:
Organization
[],
targetId
:
string
,
path
:
string
[]
=
[]):
string
[]
|
null
=>
{
for
(
const
org
of
orgs
)
{
if
(
org
.
id
==
targetId
)
{
return
[...
path
,
org
.
id
]
}
if
(
org
.
children
)
{
const
result
=
findParentPath
(
org
.
children
,
targetId
,
[...
path
,
org
.
id
])
if
(
result
)
return
result
}
}
return
null
}
const
path
=
findParentPath
(
props
.
organizations
,
targetOrgId
)
console
.
log
(
'展开路径:'
,
path
,
'目标ID:'
,
targetOrgId
)
if
(
path
)
{
// 展开路径上的所有组织(除了目标组织本身)
path
.
slice
(
0
,
-
1
).
forEach
(
orgId
=>
{
organizationExpandedIds
.
value
.
add
(
orgId
)
})
console
.
log
(
'展开的组织ID:'
,
Array
.
from
(
organizationExpandedIds
.
value
))
}
else
{
console
.
warn
(
'未找到目标组织:'
,
targetOrgId
)
}
}
const
isOrganizationSelectable
=
(
orgType
:
string
,
roleId
:
string
):
boolean
=>
{
// 只根据账号类型进行组织层级限制,不根据角色层级限制
const
accountType
=
formData
.
value
.
accountType
...
...
@@ -574,24 +627,41 @@ const handleSave = async () => {
ElMessage
.
error
(
'请选择角色'
)
return
}
// 当前登录用户不需要验证组织(不可修改)
if
(
!
editingUser
.
value
||
!
isCurrentUser
(
editingUser
.
value
))
{
if
(
!
formData
.
value
.
organizationId
)
{
ElMessage
.
error
(
'请选择所属区域'
)
return
}
}
const
response
=
await
$api
.
addAndUpdateRole
(
{
let
data
=
{
id
:
editingUser
.
value
?
editingUser
.
value
.
id
:
''
,
userCode
:
formData
.
value
.
username
.
trim
(),
user
N
ame
:
formData
.
value
.
realName
.
trim
(),
user
n
ame
:
formData
.
value
.
realName
.
trim
(),
phone
:
formData
.
value
.
phone
.
trim
(),
userType
:
formData
.
value
.
accountType
,
roleId
:
formData
.
value
.
roleId
,
status
:
formData
.
value
.
isActive
?
'1'
:
'0'
,
areaId
:
formData
.
value
.
organizationId
})
}
if
(
editingUser
.
value
){
delete
data
.
userCode
if
(
editingUser
.
value
.
username
==
formData
.
value
.
realName
.
trim
()){
delete
data
.
username
}
if
(
editingUser
.
value
.
phone
==
formData
.
value
.
phone
.
trim
()){
delete
data
.
phone
}
if
(
editingUser
.
value
.
userType
==
formData
.
value
.
accountType
){
delete
data
.
userType
}
if
(
editingUser
.
value
.
roleId
==
formData
.
value
.
roleId
){
delete
data
.
roleId
}
if
(
editingUser
.
value
.
status
==
(
formData
.
value
.
isActive
?
'1'
:
'0'
)){
delete
data
.
status
}
if
(
editingUser
.
value
.
areaId
==
formData
.
value
.
organizationId
){
delete
data
.
areaId
}
}
const
response
=
await
$api
.
addAndUpdateRole
(
data
)
if
(
response
.
c
===
0
)
{
getAccountList
()
ElMessage
.
success
(
editingUser
.
value
?
'编辑成功'
:
'创建成功'
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment