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