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 969889c6
authored
Nov 24, 2025
by
李宁
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1
1 parent
dd3bdb7a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
134 deletions
channelBusiManage/src/assets/js/api/interface/account/index.js
channelBusiManage/src/components/DesktopMain.vue
channelBusiManage/src/components/OrganizationTree.vue
channelBusiManage/src/components/RoleManagement.vue
channelBusiManage/src/components/UserManagement.vue
channelBusiManage/src/assets/js/api/interface/account/index.js
View file @
969889c
...
...
@@ -5,37 +5,28 @@ import request from '../../request'
*/
export
function
queryAccountList
(
data
)
{
return
request
({
url
:
'/c
ompass/api/system/account/page
'
,
url
:
'/c
rm/getUserPageList
'
,
data
,
})
}
/**
* 查询角色列表
*/
export
function
queryRoleList
(
data
)
{
return
request
({
url
:
'/compass/api/common/enums/account-roles'
,
method
:
'GET'
})
}
/**
* 删除账号
* 添加/更新账号
*/
export
function
dele
teRole
(
data
)
{
export
function
addAndUpda
teRole
(
data
)
{
return
request
({
url
:
'/c
ompass/api/system/account/delete'
,
url
:
'/c
rm'
+
(
data
.
id
?
'/updateUser'
:
'/createUser'
)
,
data
,
})
}
/**
*
添加/更新账号
*
获取指定区域下的所有区域
*/
export
function
addAndUpdateRole
(
data
)
{
export
function
queryAreaData
(
data
)
{
return
request
({
url
:
'/c
ompass/api/system/account'
+
(
data
.
id
?
'/update'
:
'/create'
)
,
data
,
url
:
'/c
rm/getArea?areaId='
+
data
.
areaId
,
method
:
'GET'
})
}
\ No newline at end of file
channelBusiManage/src/components/DesktopMain.vue
View file @
969889c
...
...
@@ -15,7 +15,6 @@
<span
class=
"text-[16px]"
>
享零工云平台
</span>
</h1>
</div>
<!-- 导航菜单 -->
<nav
class=
"flex-1 py-6 px-3 overflow-hidden"
>
<div
class=
"space-y-6"
>
...
...
@@ -62,7 +61,6 @@
</button>
</
template
>
</div>
<!-- 系统管理菜单 -->
<div
class=
"space-y-1"
v-if=
"systemMenuItems.length>0"
>
<div
v-if=
"!isSidebarCollapsed"
class=
"px-4 mb-2"
>
...
...
@@ -110,7 +108,6 @@
</div>
</div>
</nav>
<!-- 收缩按钮 -->
<div
class=
"p-4 border-t border-neutral-800"
>
<button
...
...
@@ -132,7 +129,6 @@
</button>
</div>
</div>
<!-- 右侧主内容区 -->
<div
class=
"flex-1 flex flex-col overflow-hidden"
>
<!-- 顶部Header -->
...
...
@@ -188,7 +184,6 @@
</div>
</
template
>
</div>
<!-- 用户下拉菜单 -->
<el-dropdown
trigger=
"click"
@
command=
"handleCommand"
>
<el-button
...
...
@@ -216,7 +211,6 @@
</
template
>
</el-dropdown>
</header>
<!-- 页面内容区 -->
<main
class=
"flex-1 overflow-auto p-6 bg-[#F0F2F5]"
>
<!-- 订单监控页面 -->
...
...
@@ -276,7 +270,6 @@
</div>
</div>
</template>
<
script
setup
lang=
"ts"
>
import
{
ref
,
computed
}
from
'vue'
import
{
...
...
@@ -290,10 +283,8 @@ import {
ChevronDown
}
from
'lucide-vue-next'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
// 导入图片资源
import
platformLogoImg
from
'@/assets/8a3322d5ba8c2ae3592af24d73566a63828a3a27.png'
// 导入子组件
import
OrderMonitoring
from
'./OrderMonitoring.vue'
import
OrderDetail
from
'./OrderDetail.vue'
...
...
@@ -301,9 +292,7 @@ import BusinessRulesManagement from './BusinessRulesManagement.vue'
import
RoleManagement
,
{
type
Permission
}
from
'./RoleManagement.vue'
import
UserManagement
,
{
type
User
as
UserType
}
from
'./UserManagement.vue'
import
RoleIcon
from
'./icons/RoleIcon.vue'
const
platformLogo
=
ref
(
platformLogoImg
)
// 本地Role类型定义,确保permissions字段是必需的
interface
Role
{
id
:
string
...
...
@@ -314,22 +303,17 @@ interface Role {
status
:
'启用'
|
'禁用'
createTime
?:
string
}
interface
DesktopMainProps
{
currentUser
:
{
username
:
string
;
role
:
'admin'
|
'viewer'
}
|
null
;
}
const
props
=
defineProps
<
DesktopMainProps
>
()
const
emit
=
defineEmits
([
'logout'
])
// 响应式数据
const
isSidebarCollapsed
=
ref
(
false
)
const
activeMenu
=
ref
<
string
>
(
'orders'
)
// 当前激活的菜单
const
activeView
=
ref
<
string
>
(
'orders'
)
// 当前显示的视图
const
selectedOrderId
=
ref
<
string
|
null
>
(
null
)
// 当前查看的订单ID
const
userInfo
=
ref
(
localStorage
.
getItem
(
'pcUserInfo'
)?
JSON
.
parse
(
localStorage
.
getItem
(
'pcUserInfo'
)):{})
// 菜单配置
// const businessMenuItems = [
// { id: 'orders', label: '登记订单管理', icon: LayoutDashboard },
...
...
@@ -353,10 +337,8 @@ const businessMenuItems = computed(() => {
return
barr
}
}
return
[]
})
// const systemMenuItems = [
// { id: 'roles', label: '角色管理', icon: RoleIcon },
// { id: 'users', label: '账号管理', icon: Users }
...
...
@@ -379,24 +361,20 @@ const systemMenuItems = computed(() => {
return
barr
}
}
return
[]
})
const
menuMap
:
Record
<
string
,
string
>
=
{
orders
:
'登记订单管理'
,
business
:
'业务酬金管理'
,
roles
:
'角色管理'
,
users
:
'账号管理'
,
}
const
currentMenuTitle
=
computed
(()
=>
{
if
(
activeView
.
value
===
'order-detail'
)
{
return
'订单详情'
}
return
menuMap
[
activeView
.
value
]
||
'首页'
})
// 业务规则数据
const
businessRules
=
ref
<
BusinessRule
[]
>
([
{
...
...
@@ -432,14 +410,11 @@ const businessRules = ref<BusinessRule[]>([
createTime
:
'2025-10-20 10:15'
}
])
// 模拟订单数据
// 使用空数组,让 OrderMonitoring 组件自动生成模拟数据
const
orders
=
ref
([])
// 存储从 OrderMonitoring 组件获取的订单数据
const
allOrders
=
ref
([]
as
any
[])
// 类型定义
interface
BusinessRule
{
id
:
string
...
...
@@ -449,8 +424,6 @@ interface BusinessRule {
status
:
"生效中"
|
"已停用"
createTime
:
string
}
interface
Organization
{
id
:
string
name
:
string
...
...
@@ -458,8 +431,6 @@ interface Organization {
parentId
?:
string
children
?:
Organization
[]
}
// 角色管理数据
const
roles
=
ref
<
Role
[]
>
([
{
...
...
@@ -509,21 +480,17 @@ const roles = ref<Role[]>([
createTime
:
'2025-10-20 10:00:00'
}
])
// 权限数据
const
permissions
=
ref
<
Permission
[]
>
(
JSON
.
parse
(
localStorage
.
getItem
(
'pcUserInfo'
)
||
'{}'
).
functions
||
[])
// 根据订单ID获取订单详情
const
getOrderById
=
(
orderId
:
string
)
=>
{
return
allOrders
.
value
.
find
((
order
:
any
)
=>
order
.
id
===
orderId
)
}
// 方法
const
handleMenuChange
=
(
menuId
:
string
)
=>
{
activeMenu
.
value
=
menuId
activeView
.
value
=
menuId
}
const
handleCommand
=
(
command
:
string
)
=>
{
if
(
command
===
'logout'
)
{
ElMessageBox
.
confirm
(
'确定要退出登录吗?'
,
'提示'
,
{
...
...
@@ -540,17 +507,14 @@ const handleCommand = (command: string) => {
ElMessage
.
info
(
`点击了
${
command
}
`
)
}
}
const
handleViewOrderDetail
=
(
order
:
any
)
=>
{
selectedOrderId
.
value
=
order
.
id
activeView
.
value
=
'order-detail'
}
const
handleBackToOrders
=
()
=>
{
selectedOrderId
.
value
=
null
activeView
.
value
=
'orders'
}
const
handleUpdateOrder
=
(
updates
:
any
)
=>
{
// 更新 allOrders 中的订单数据
const
orderIndex
=
allOrders
.
value
.
findIndex
(
order
=>
order
.
id
===
selectedOrderId
.
value
)
...
...
@@ -560,12 +524,10 @@ const handleUpdateOrder = (updates: any) => {
console
.
log
(
'更新订单:'
,
updates
)
ElMessage
.
success
(
'订单更新成功'
)
}
// 接收来自 OrderMonitoring 组件的订单数据
const
handleOrdersUpdate
=
(
ordersList
:
any
[])
=>
{
allOrders
.
value
=
ordersList
}
// 面包屑导航点击处理
const
handleBreadcrumbClick
=
(
level
:
string
)
=>
{
if
(
level
===
'level1'
)
{
...
...
@@ -579,7 +541,6 @@ const handleBreadcrumbClick = (level: string) => {
}
}
}
// 业务规则管理方法
const
handleAddBusinessRule
=
(
ruleData
:
Omit
<
BusinessRule
,
'id'
|
'createTime'
>
)
=>
{
const
newRule
=
{
...
...
@@ -597,7 +558,6 @@ const handleAddBusinessRule = (ruleData: Omit<BusinessRule, 'id' | 'createTime'>
ElMessage
.
success
(
'业务规则创建成功'
)
console
.
log
(
'新增业务规则:'
,
newRule
)
}
const
handleUpdateBusinessRule
=
(
ruleId
:
string
,
updates
:
Partial
<
BusinessRule
>
)
=>
{
const
ruleIndex
=
businessRules
.
value
.
findIndex
(
rule
=>
rule
.
id
===
ruleId
)
if
(
ruleIndex
!==
-
1
)
{
...
...
@@ -610,7 +570,6 @@ const handleUpdateBusinessRule = (ruleId: string, updates: Partial<BusinessRule>
console
.
log
(
'更新业务规则:'
,
ruleId
,
updates
)
}
}
const
handleToggleBusinessRuleStatus
=
(
ruleId
:
string
)
=>
{
const
ruleIndex
=
businessRules
.
value
.
findIndex
(
rule
=>
rule
.
id
===
ruleId
)
if
(
ruleIndex
!==
-
1
)
{
...
...
@@ -624,7 +583,6 @@ const handleToggleBusinessRuleStatus = (ruleId: string) => {
}
}
}
const
handleDeleteBusinessRule
=
(
ruleId
:
string
)
=>
{
const
ruleIndex
=
businessRules
.
value
.
findIndex
(
rule
=>
rule
.
id
===
ruleId
)
if
(
ruleIndex
!==
-
1
)
{
...
...
@@ -633,7 +591,6 @@ const handleDeleteBusinessRule = (ruleId: string) => {
console
.
log
(
'删除业务规则:'
,
ruleId
)
}
}
// 角色管理方法
const
handleAddRole
=
(
roleData
:
any
)
=>
{
const
newRole
:
Role
=
{
...
...
@@ -652,7 +609,6 @@ const handleAddRole = (roleData: any) => {
roles
.
value
.
push
(
newRole
)
console
.
log
(
'新增角色:'
,
newRole
)
}
const
handleUpdateRole
=
(
roleId
:
string
,
updates
:
any
)
=>
{
const
roleIndex
=
roles
.
value
.
findIndex
(
role
=>
role
.
id
===
roleId
)
if
(
roleIndex
!==
-
1
)
{
...
...
@@ -667,7 +623,6 @@ const handleUpdateRole = (roleId: string, updates: any) => {
}
}
}
// 组织架构数据
const
organizations
=
ref
<
Organization
[]
>
([
{
...
...
@@ -720,10 +675,8 @@ const organizations = ref<Organization[]>([
]
}
])
// 当前登录用户ID
const
currentUserId
=
ref
(
'user-001'
)
// 用户数据
const
users
=
ref
<
UserType
[]
>
([
{
...
...
@@ -775,7 +728,6 @@ const users = ref<UserType[]>([
creatorId
:
'user-001'
}
])
// 用户管理方法
const
handleAddUser
=
(
userData
:
Omit
<
UserType
,
'id'
|
'createTime'
|
'creatorId'
>
)
=>
{
const
newUser
=
{
...
...
@@ -794,7 +746,6 @@ const handleAddUser = (userData: Omit<UserType, 'id' | 'createTime' | 'creatorId
users
.
value
.
push
(
newUser
)
console
.
log
(
'新增用户:'
,
newUser
)
}
const
handleUpdateUser
=
(
userId
:
string
,
updates
:
Partial
<
UserType
>
)
=>
{
const
userIndex
=
users
.
value
.
findIndex
(
user
=>
user
.
id
===
userId
)
if
(
userIndex
!==
-
1
)
{
...
...
@@ -806,7 +757,6 @@ const handleUpdateUser = (userId: string, updates: Partial<UserType>) => {
console
.
log
(
'更新用户:'
,
userId
,
updates
)
}
}
const
handleDeleteUser
=
(
userId
:
string
)
=>
{
const
userIndex
=
users
.
value
.
findIndex
(
user
=>
user
.
id
===
userId
)
if
(
userIndex
!==
-
1
)
{
...
...
@@ -815,18 +765,15 @@ const handleDeleteUser = (userId: string) => {
}
}
</
script
>
<
style
scoped
>
/* 隐藏滚动条但保持滚动功能 */
.hide-scrollbar
{
scrollbar-width
:
none
;
/* Firefox */
-ms-overflow-style
:
none
;
/* IE and Edge */
}
.hide-scrollbar
::-webkit-scrollbar
{
display
:
none
;
/* Chrome, Safari, and Opera */
}
/* 移除右上角用户信息按钮的悬浮背景效果 */
:deep
(
header
.el-button.is-text
:hover
),
:deep
(
header
.el-button.is-text
:focus
),
...
...
channelBusiManage/src/components/OrganizationTree.vue
View file @
969889c
...
...
@@ -48,7 +48,6 @@
class=
"inline-block w-2 h-2 rounded-sm bg-white"
/>
</div>
<!-- 组织图标 -->
<Building2
:class=
"[
...
...
@@ -110,11 +109,9 @@
</div>
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
computed
}
from
'vue'
import
{
Building2
,
ChevronDown
,
ChevronRight
}
from
'lucide-vue-next'
interface
Organization
{
id
:
string
name
:
string
...
...
@@ -122,13 +119,11 @@ interface Organization {
parentId
?:
string
children
?:
Organization
[]
}
interface
Role
{
id
:
string
name
:
string
level
:
'地市级'
|
'区县级'
|
'一线人员'
}
interface
Props
{
organizations
:
Organization
[]
selectedId
?:
string
...
...
@@ -137,7 +132,6 @@ interface Props {
expandedIds
?:
Set
<
string
>
accountType
?:
'地市级'
|
'区县级'
|
'一线人员'
}
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
selectedId
:
''
,
roleId
:
''
,
...
...
@@ -145,12 +139,10 @@ const props = withDefaults(defineProps<Props>(), {
expandedIds
:
()
=>
new
Set
(),
accountType
:
undefined
})
const
emit
=
defineEmits
<
{
select
:
[
orgId
:
string
]
'toggle-expand'
:
[
orgId
:
string
]
}
>
()
// 如果没有传入 expandedIds,使用本地状态
const
localExpandedIds
=
ref
(
new
Set
<
string
>
())
const
expandedIds
=
computed
(()
=>
...
...
@@ -158,12 +150,10 @@ const expandedIds = computed(() =>
?
props
.
expandedIds
:
localExpandedIds
.
value
)
// 工具函数
const
hasChildren
=
(
org
:
Organization
):
boolean
=>
{
return
!!
(
org
.
children
&&
org
.
children
.
length
>
0
)
}
const
isSelectable
=
(
org
:
Organization
):
boolean
=>
{
console
.
log
(
'检查组织可选性:'
,
org
.
name
,
org
.
type
,
'账号类型:'
,
props
.
accountType
)
...
...
@@ -196,7 +186,6 @@ const isSelectable = (org: Organization): boolean => {
// 如果没有账号类型,可以选择所有组织
return
true
}
// 检查组织是否属于区县下
const
isUnderCounty
=
(
org
:
Organization
):
boolean
=>
{
console
.
log
(
'OrganizationTree.vue:202 检查组织是否属于区县下:'
,
org
.
name
,
org
.
type
,
org
.
id
)
...
...
@@ -239,7 +228,6 @@ const isUnderCounty = (org: Organization): boolean => {
console
.
log
(
'OrganizationTree.vue:241 未找到区县父组织'
)
return
false
}
const
getOrgTypeLabel
=
(
type
:
Organization
[
'type'
])
=>
{
switch
(
type
)
{
case
'地市'
:
...
...
@@ -252,21 +240,18 @@ const getOrgTypeLabel = (type: Organization['type']) => {
return
type
}
}
const
getRoleLevel
=
(
roleId
:
string
):
string
=>
{
if
(
!
props
.
roles
||
props
.
roles
.
length
===
0
)
return
'区县级'
const
role
=
props
.
roles
.
find
(
r
=>
r
.
id
===
roleId
)
return
role
?
role
.
level
:
'区县级'
}
// 事件处理
const
handleSelect
=
(
org
:
Organization
)
=>
{
if
(
isSelectable
(
org
))
{
emit
(
'select'
,
org
.
id
)
}
}
const
toggleExpand
=
(
orgId
:
string
)
=>
{
if
(
props
.
expandedIds
&&
props
.
expandedIds
.
size
>
0
)
{
// 使用父组件的展开状态
...
...
@@ -280,11 +265,9 @@ const toggleExpand = (orgId: string) => {
}
}
}
const
handleToggleExpand
=
(
orgId
:
string
)
=>
{
emit
(
'toggle-expand'
,
orgId
)
}
// 初始化展开顶级组织
if
(
props
.
expandedIds
&&
props
.
expandedIds
.
size
===
0
)
{
props
.
organizations
.
forEach
(
org
=>
{
...
...
@@ -294,128 +277,98 @@ if (props.expandedIds && props.expandedIds.size === 0) {
})
}
</
script
>
<
style
scoped
>
.space-y-1
>
*
+
*
{
margin-top
:
0.25rem
;
}
.flex
{
display
:
flex
;
}
.items-center
{
align-items
:
center
;
}
.gap-2
{
gap
:
0.5rem
;
}
.p-1
{
padding
:
0.25rem
;
}
.p-2
{
padding
:
0.5rem
;
}
.rounded
{
border-radius
:
0.25rem
;
}
.cursor-pointer
{
cursor
:
pointer
;
}
.cursor-not-allowed
{
cursor
:
not-allowed
;
}
.transition-colors
{
transition-property
:
color
,
background-color
,
border-color
,
text-decoration-color
,
fill
,
stroke
;
transition-timing-function
:
cubic-bezier
(
0.4
,
0
,
0.2
,
1
);
transition-duration
:
150ms
;
}
.opacity-40
{
opacity
:
0.4
;
}
.bg-blue-50
{
background-color
:
#eff6ff
;
}
.border
{
border-width
:
1px
;
}
.border-blue-500
{
border-color
:
#3b82f6
;
}
.hover
\
:bg-neutral-50:hover
{
background-color
:
#f9fafb
;
}
.hover
\
:bg-neutral-200:hover
{
background-color
:
#e5e7eb
;
}
.h-4
{
height
:
1rem
;
}
.w-4
{
width
:
1rem
;
}
.w-6
{
width
:
1.5rem
;
}
.text-neutral-300
{
color
:
#d1d5db
;
}
.text-neutral-400
{
color
:
#9ca3af
;
}
.text-neutral-500
{
color
:
#6b7280
;
}
.text-neutral-600
{
color
:
#4b5563
;
}
.text-neutral-900
{
color
:
#111827
;
}
.text-blue-600
{
color
:
#2563eb
;
}
.text-xs
{
font-size
:
0.75rem
;
line-height
:
1rem
;
}
.flex-1
{
flex
:
1
1
0%
;
}
.ml-4
{
margin-left
:
1rem
;
}
.border-l-2
{
border-left-width
:
2px
;
}
.border-neutral-200
{
border-color
:
#e5e7eb
;
}
</
style
>
</
style
>
\ No newline at end of file
channelBusiManage/src/components/RoleManagement.vue
View file @
969889c
...
...
@@ -261,19 +261,30 @@ const topLevelPermissions = computed(() =>
const
filteredRoles
=
ref
([])
const
getAllIds
=
(
tree
)
=>
{
const
ids
=
[]
// 结果池
const
stack
=
[...
tree
]
// 根节点入栈
while
(
stack
.
length
)
{
const
node
=
stack
.
pop
()
if
(
node
.
id
!==
undefined
)
ids
.
push
(
node
.
id
)
// 收集当前节点
if
(
node
.
children
?.
length
)
{
// 子节点全部入栈(顺序无所谓就 push,要顺序就 unshift)
stack
.
push
(...
node
.
children
)
}
}
return
ids
}
// 获取角色的权限ID列表,兼容不同的字段名
const
getRolePermissionIds
=
async
(
role
:
Role
)
=>
{
try
{
const
response
=
await
$api
.
queryRolePermission
({
id
:
role
.
id
})
return
[
1
,
2
,
3
,
4
]
if
(
response
.
c
===
0
&&
response
.
d
)
{
// 假设返回的数据结构是 { functionIds: ['id1', 'id2', ...] }
return
response
.
d
.
functionIds
||
response
.
d
.
permissionIds
||
[]
return
getAllIds
(
response
.
d
.
list
)
}
else
{
console
.
warn
(
'获取角色权限失败:'
,
response
.
msg
)
return
role
.
permissionIds
||
role
.
permissions
||
[]
...
...
@@ -340,17 +351,8 @@ const handleSave = async () => {
return
}
const
roleData
=
{
name
:
roleName
.
value
.
trim
(),
description
:
roleDescription
.
value
.
trim
(),
permissionIds
:
selectedPermissions
.
value
,
status
:
roleStatus
.
value
}
console
.
log
(
roleData
)
const
response
=
await
$api
.
createOrUpdateRole
({
roleId
:
''
,
roleId
:
editingRole
.
value
?
editingRole
.
value
.
id
:
''
,
roleName
:
roleName
.
value
.
trim
(),
remark
:
roleDescription
.
value
.
trim
(),
status
:
roleStatus
.
value
,
...
...
channelBusiManage/src/components/UserManagement.vue
View file @
969889c
This diff is collapsed.
Click to expand it.
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