Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f3a5f760
authored
Dec 01, 2025
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 岗位助理配置CRUD接口联调
1 parent
4783f1c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
125 deletions
apps/frontend/venus-agentic/venus-agentic-assisant/src/api/assistant.ts
apps/frontend/venus-agentic/venus-agentic-assisant/src/api/dept.ts
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/Assistant/addUpdate.vue
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/Assistant/index.vue
apps/frontend/venus-agentic/venus-agentic-base/src/config/center.ts
apps/frontend/venus-agentic/venus-agentic-base/src/stores/user.ts
apps/frontend/venus-agentic/venus-agentic-assisant/src/api/assistant.ts
View file @
f3a5f76
import
{
gscPost
}
from
'@/utils/gscRequest'
;
import
{
gscPost
}
from
'@/utils/gscRequest'
;
/**
/**
*
示例:用户登录
*
岗位助理列表
*/
*/
export
async
function
assistantList
(
data
:
any
)
{
export
async
function
assistantList
(
data
:
any
)
{
try
{
try
{
...
@@ -11,3 +11,51 @@ export async function assistantList(data: any) {
...
@@ -11,3 +11,51 @@ export async function assistantList(data: any) {
throw
error
;
throw
error
;
}
}
}
}
/**
* 岗位助理详情
*/
export
async
function
assistantDetail
(
data
:
any
)
{
try
{
const
response
=
await
gscPost
(
'/jobAgentDetail/detailById'
,
data
);
return
response
;
}
catch
(
error
)
{
throw
error
;
}
}
/**
* 岗位助理创建
*/
export
async
function
assistantCreate
(
data
:
any
)
{
try
{
const
response
=
await
gscPost
(
'/jobAgentInfo/create'
,
data
);
return
response
;
}
catch
(
error
)
{
throw
error
;
}
}
/**
* 岗位助理更新
*/
export
async
function
assistantUpdate
(
data
:
any
)
{
try
{
const
response
=
await
gscPost
(
'/jobAgentInfo/update'
,
data
);
return
response
;
}
catch
(
error
)
{
throw
error
;
}
}
/**
* 岗位助理状态修改
*/
export
async
function
assistantStatus
(
data
:
any
)
{
try
{
const
response
=
await
gscPost
(
'/jobAgentInfo/forbiddenOrEnable'
,
data
);
return
response
;
}
catch
(
error
)
{
throw
error
;
}
}
apps/frontend/venus-agentic/venus-agentic-assisant/src/api/dept.ts
0 → 100644
View file @
f3a5f76
import
{
gscPost
}
from
'@/utils/gscRequest'
;
/**
* 企微部门模块树
*/
export
async
function
findDeptTree
(
data
:
any
)
{
try
{
const
response
=
await
gscPost
(
'/entmicroDepartment/findDeptTree'
,
data
);
return
response
;
}
catch
(
error
)
{
throw
error
;
}
}
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/Assistant/addUpdate.vue
View file @
f3a5f76
This diff is collapsed.
Click to expand it.
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/Assistant/index.vue
View file @
f3a5f76
<
script
setup
>
<
script
setup
>
import
{
computed
,
onMounted
,
reactive
,
ref
}
from
'vue'
;
import
{
onMounted
,
reactive
,
ref
}
from
'vue'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
Plus
}
from
'@element-plus/icons-vue'
;
import
{
ElMessage
}
from
'element-plus'
;
import
{
ElMessage
}
from
'element-plus'
;
import
{
assistantList
}
from
'@/api/assistant'
;
import
{
assistantList
,
assistantStatus
}
from
'@/api/assistant'
;
import
{
findDeptTree
}
from
'@/api/dept'
;
const
router
=
useRouter
();
const
router
=
useRouter
();
// --- 1. 状态定义 ---
// --- 1. 状态定义 ---
const
loading
=
ref
(
false
);
const
loading
=
ref
(
false
);
const
selectedIds
=
ref
([]);
const
selectedIds
=
ref
([]);
const
isInitializing
=
ref
(
true
);
// 标记是否正在初始化,防止首次加载时触发状态变更
// 搜索表单
// 搜索表单
const
searchForm
=
reactive
({
const
searchForm
=
reactive
({
n
ame
:
''
,
agentN
ame
:
''
,
status
:
''
,
// 空字符串代表全部,true/false代表具体状态
status
:
''
,
// 空字符串代表全部,true/false代表具体状态
});
});
...
@@ -20,77 +21,80 @@ const searchForm = reactive({
...
@@ -20,77 +21,80 @@ const searchForm = reactive({
const
pagination
=
reactive
({
const
pagination
=
reactive
({
currentPage
:
1
,
currentPage
:
1
,
pageSize
:
10
,
pageSize
:
10
,
total
:
0
,
});
});
//
原始数据(模拟数据库)
//
列表数据
const
all
Data
=
ref
([]);
const
table
Data
=
ref
([]);
// --- 2. 模拟数据生成 ---
const
getList
=
async
()
=>
{
const
initMockData
=
()
=>
{
try
{
const
baseData
=
[
loading
.
value
=
true
;
{
name
:
'销售顾问AI'
,
department
:
'深圳旗舰店销售部'
,
status
:
true
},
isInitializing
.
value
=
true
;
// 开始加载数据时,标记为初始化状态
{
name
:
'客服助手'
,
department
:
'客户服务中心'
,
status
:
true
},
const
requestData
=
{
{
name
:
'培训导师'
,
department
:
'人力资源部'
,
status
:
false
},
t
:
{
];
agentName
:
searchForm
.
agentName
||
undefined
,
status
:
searchForm
.
status
===
''
?
undefined
:
Number
(
searchForm
.
status
),
const
list
=
[];
},
for
(
let
i
=
0
;
i
<
101
;
i
++
)
{
currentPage
:
pagination
.
currentPage
,
const
template
=
baseData
[
i
%
3
];
pageSize
:
pagination
.
pageSize
,
list
.
push
({
};
id
:
i
+
1
,
const
res
=
await
assistantList
(
requestData
);
name
:
`
${
template
.
name
}
${
i
+
1
}
`
,
// 加上序号区分
console
.
log
(
'getList'
,
res
);
department
:
template
.
department
,
createTime
:
'2025-10-25 10:30:00'
,
// 根据实际接口返回结构解析数据
status
:
i
%
5
!==
0
,
// 随机一些状态
let
records
=
[];
let
total
=
0
;
let
current
=
1
;
if
(
res
&&
res
.
data
)
{
records
=
res
.
data
.
records
||
res
.
data
.
list
||
[];
total
=
res
.
data
.
total
||
0
;
current
=
res
.
data
.
current
||
res
.
data
.
currentPage
||
1
;
}
else
if
(
res
&&
Array
.
isArray
(
res
.
records
))
{
// 兼容直接返回分页数据的情况
records
=
res
.
records
||
[];
total
=
res
.
total
||
0
;
current
=
res
.
current
||
res
.
currentPage
||
1
;
}
// 为每条记录添加 statusLoading 字段,并将 status 从数字转换为布尔值
tableData
.
value
=
records
.
map
((
item
)
=>
({
...
item
,
status
:
item
.
status
===
1
||
item
.
status
===
true
,
// 将数字 1/0 转换为布尔值 true/false
statusLoading
:
false
,
statusLoading
:
false
,
});
}));
pagination
.
total
=
total
;
pagination
.
currentPage
=
current
;
}
catch
(
error
)
{
console
.
error
(
'获取列表失败:'
,
error
);
ElMessage
.
error
(
'获取列表失败,请稍后重试'
);
tableData
.
value
=
[];
pagination
.
total
=
0
;
}
finally
{
loading
.
value
=
false
;
// 数据加载完成后,标记初始化完成
// 使用 nextTick 确保 DOM 更新完成后再允许状态变更
setTimeout
(()
=>
{
isInitializing
.
value
=
false
;
},
0
);
}
}
allData
.
value
=
list
;
};
};
const
getList
=
async
()
=>
{
// 获取部门树数据并存储到 sessionStorage
let
requestData
=
{
const
getDeptTree
=
async
()
=>
{
"t"
:
{
try
{
"agentName"
:
searchForm
.
name
,
const
res
=
await
findDeptTree
({});
"status"
:
searchForm
.
status
,
// 将部门数据存储到 sessionStorage,供编辑页面使用
},
const
deptData
=
res
?.
data
||
res
||
[];
"currentPage"
:
pagination
.
currentPage
,
sessionStorage
.
setItem
(
'deptTreeData'
,
JSON
.
stringify
(
deptData
));
"pageSize"
:
pagination
.
pageSize
,
}
catch
(
error
)
{
}
console
.
error
(
'获取部门树数据失败:'
,
error
);
const
res
=
await
assistantList
(
requestData
);
// 不显示错误提示,避免影响列表页面的正常使用
if
(
res
.
code
===
200
)
{
allData
.
value
=
res
.
data
.
list
;
pagination
.
total
=
res
.
data
.
total
;
}
else
{
ElMessage
.
error
(
res
.
message
);
allData
.
value
=
[];
pagination
.
total
=
0
;
}
}
};
};
onMounted
(()
=>
{
onMounted
(()
=>
{
initMockData
();
getList
();
// getList();
getDeptTree
();
});
// --- 3. 数据处理逻辑 (前端模拟后端查询) ---
// 经过搜索过滤后的总数据
const
filteredData
=
computed
(()
=>
{
return
allData
.
value
.
filter
((
item
)
=>
{
const
matchName
=
item
.
name
.
includes
(
searchForm
.
name
);
const
matchStatus
=
searchForm
.
status
===
''
||
item
.
status
===
searchForm
.
status
;
return
matchName
&&
matchStatus
;
});
});
// 过滤后的总条数
const
filteredTotal
=
computed
(()
=>
filteredData
.
value
.
length
);
// 当前页显示的数据(切片)
const
currentPageData
=
computed
(()
=>
{
const
start
=
(
pagination
.
currentPage
-
1
)
*
pagination
.
pageSize
;
const
end
=
start
+
pagination
.
pageSize
;
return
filteredData
.
value
.
slice
(
start
,
end
);
});
});
// --- 4. 事件处理 ---
// --- 4. 事件处理 ---
...
@@ -98,15 +102,15 @@ const currentPageData = computed(() => {
...
@@ -98,15 +102,15 @@ const currentPageData = computed(() => {
// 查询
// 查询
const
handleSearch
=
()
=>
{
const
handleSearch
=
()
=>
{
pagination
.
currentPage
=
1
;
// 查询时重置到第一页
pagination
.
currentPage
=
1
;
// 查询时重置到第一页
ElMessage
.
success
(
'查询成功'
);
getList
(
);
};
};
// 重置
// 重置
const
handleReset
=
()
=>
{
const
handleReset
=
()
=>
{
searchForm
.
n
ame
=
''
;
searchForm
.
agentN
ame
=
''
;
searchForm
.
status
=
''
;
searchForm
.
status
=
''
;
pagination
.
currentPage
=
1
;
pagination
.
currentPage
=
1
;
ElMessage
.
info
(
'已重置搜索条件'
);
getList
(
);
};
};
// 表格多选
// 表格多选
...
@@ -115,15 +119,31 @@ const handleSelectionChange = (selection) => {
...
@@ -115,15 +119,31 @@ const handleSelectionChange = (selection) => {
};
};
// 状态切换
// 状态切换
const
handleStatusChange
=
(
row
)
=>
{
const
handleStatusChange
=
async
(
row
)
=>
{
// 如果是初始化阶段,直接返回,不触发状态变更
if
(
isInitializing
.
value
)
{
return
;
}
row
.
statusLoading
=
true
;
row
.
statusLoading
=
true
;
// 模拟API请求延迟
try
{
setTimeout
(()
=>
{
const
requestData
=
{
row
.
statusLoading
=
false
;
id
:
row
.
id
,
status
:
Number
(
row
.
status
),
};
await
assistantStatus
(
requestData
);
ElMessage
.
success
(
ElMessage
.
success
(
`
${
row
.
name
}
状态已更新为:
${
row
.
status
?
'启用'
:
'禁用'
}
`
,
`
${
row
.
agentName
||
row
.
name
}
状态已更新为:
${
row
.
status
?
'启用'
:
'禁用'
}
`
,
);
);
},
500
);
// 状态更新成功后,可以选择刷新列表或保持当前状态
// getList(); // 如果需要刷新列表,取消注释此行
}
catch
(
error
)
{
// 如果接口调用失败,恢复原状态
row
.
status
=
!
row
.
status
;
console
.
error
(
'状态更新失败:'
,
error
);
ElMessage
.
error
(
'状态更新失败,请稍后重试'
);
}
finally
{
row
.
statusLoading
=
false
;
}
};
};
// 新增
// 新增
...
@@ -140,10 +160,12 @@ const handleEdit = (row) => {
...
@@ -140,10 +160,12 @@ const handleEdit = (row) => {
const
handleSizeChange
=
(
val
)
=>
{
const
handleSizeChange
=
(
val
)
=>
{
pagination
.
pageSize
=
val
;
pagination
.
pageSize
=
val
;
pagination
.
currentPage
=
1
;
pagination
.
currentPage
=
1
;
getList
();
};
};
const
handleCurrentChange
=
(
val
)
=>
{
const
handleCurrentChange
=
(
val
)
=>
{
pagination
.
currentPage
=
val
;
pagination
.
currentPage
=
val
;
getList
();
};
};
</
script
>
</
script
>
...
@@ -157,7 +179,7 @@ const handleCurrentChange = (val) => {
...
@@ -157,7 +179,7 @@ const handleCurrentChange = (val) => {
<el-form
:inline=
"true"
:model=
"searchForm"
class=
"search-form"
>
<el-form
:inline=
"true"
:model=
"searchForm"
class=
"search-form"
>
<el-form-item
label=
"智能体名称"
>
<el-form-item
label=
"智能体名称"
>
<el-input
<el-input
v-model=
"searchForm.
n
ame"
v-model=
"searchForm.
agentN
ame"
placeholder=
"请输入"
placeholder=
"请输入"
clearable
clearable
style=
"width: 220px"
style=
"width: 220px"
...
@@ -177,7 +199,7 @@ const handleCurrentChange = (val) => {
...
@@ -177,7 +199,7 @@ const handleCurrentChange = (val) => {
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item>
<el-form-item>
<el-button
type=
"primary
"
@
click=
"handleSearch"
>
查询
</el-button>
<el-button
class=
"search-btn
"
@
click=
"handleSearch"
>
查询
</el-button>
<el-button
@
click=
"handleReset"
>
重置
</el-button>
<el-button
@
click=
"handleReset"
>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -185,17 +207,18 @@ const handleCurrentChange = (val) => {
...
@@ -185,17 +207,18 @@ const handleCurrentChange = (val) => {
<!-- 3. 表格区域 -->
<!-- 3. 表格区域 -->
<el-table
<el-table
:data=
"
currentPag
eData"
:data=
"
tabl
eData"
style=
"width: 100%"
style=
"width: 100%"
:header-cell-style=
"
{ background: '#f5f7fa', color: '#606266' }"
:header-cell-style=
"
{ background: '#f5f7fa', color: '#777777',fontWeight:'normal' }"
:cell-style="{ color: '#2F3133' }"
@selection-change="handleSelectionChange"
@selection-change="handleSelectionChange"
v-loading="loading"
v-loading="loading"
>
>
<el-table-column
prop=
"
n
ame"
label=
"智能体名称"
min-width=
"150"
/>
<el-table-column
prop=
"
agentN
ame"
label=
"智能体名称"
min-width=
"150"
/>
<el-table-column
prop=
"department"
label=
"岗位关联"
min-width=
"180"
/>
<el-table-column
prop=
"department"
label=
"岗位关联"
min-width=
"180"
/>
<el-table-column
prop=
"create
Tim
e"
label=
"创建时间"
min-width=
"180"
/>
<el-table-column
prop=
"create
dDat
e"
label=
"创建时间"
min-width=
"180"
/>
<el-table-column
label=
"状态"
min-width=
"120"
>
<el-table-column
label=
"状态"
min-width=
"120"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
...
@@ -205,8 +228,8 @@ const handleCurrentChange = (val) => {
...
@@ -205,8 +228,8 @@ const handleCurrentChange = (val) => {
:loading=
"scope.row.statusLoading"
:loading=
"scope.row.statusLoading"
@
change=
"handleStatusChange(scope.row)"
@
change=
"handleStatusChange(scope.row)"
style=
"
style=
"
--el-switch-on-color: #1
3ce66
;
--el-switch-on-color: #1
956FE
;
--el-switch-off-color: #
ff4949
;
--el-switch-off-color: #
D3D6DB
;
"
"
/>
/>
<span
<span
...
@@ -230,7 +253,7 @@ const handleCurrentChange = (val) => {
...
@@ -230,7 +253,7 @@ const handleCurrentChange = (val) => {
<!-- 4. 分页区域 -->
<!-- 4. 分页区域 -->
<div
class=
"mt-5 flex items-center justify-between"
>
<div
class=
"mt-5 flex items-center justify-between"
>
<div
class=
"text-sm text-[#606266]"
>
共 {{
filteredT
otal }} 项数据
</div>
<div
class=
"text-sm text-[#606266]"
>
共 {{
pagination.t
otal }} 项数据
</div>
<div
class=
"flex items-center gap-2"
>
<div
class=
"flex items-center gap-2"
>
<el-select
<el-select
v-model=
"pagination.pageSize"
v-model=
"pagination.pageSize"
...
@@ -249,7 +272,7 @@ const handleCurrentChange = (val) => {
...
@@ -249,7 +272,7 @@ const handleCurrentChange = (val) => {
v-model:current-page=
"pagination.currentPage"
v-model:current-page=
"pagination.currentPage"
v-model:page-size=
"pagination.pageSize"
v-model:page-size=
"pagination.pageSize"
layout=
"prev, pager, next, jumper"
layout=
"prev, pager, next, jumper"
:total=
"
filteredT
otal"
:total=
"
pagination.t
otal"
@
current-change=
"handleCurrentChange"
@
current-change=
"handleCurrentChange"
/>
/>
</div>
</div>
...
@@ -263,4 +286,16 @@ const handleCurrentChange = (val) => {
...
@@ -263,4 +286,16 @@ const handleCurrentChange = (val) => {
margin-right
:
20px
;
margin-right
:
20px
;
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
/* 查询按钮样式 */
:deep
(
.search-btn
)
{
border-color
:
#1956fe
!important
;
color
:
#1956fe
!important
;
}
:deep
(
.search-btn
:hover
)
{
border-color
:
#1956fe
!important
;
color
:
#1956fe
!important
;
background-color
:
rgba
(
25
,
86
,
254
,
0.1
)
!important
;
}
</
style
>
</
style
>
apps/frontend/venus-agentic/venus-agentic-base/src/config/center.ts
View file @
f3a5f76
...
@@ -40,38 +40,7 @@ export function getGscApi(): null | Request {
...
@@ -40,38 +40,7 @@ export function getGscApi(): null | Request {
return
gscApiInstance
;
return
gscApiInstance
;
}
}
/**
* 方案2:更新 GSC API 实例的 Authorization header
* 如果 Request 类支持更新 headers,可以使用此方法
* @param token 访问令牌
*/
export
function
updateGscApiAuth
(
token
:
string
|
null
):
void
{
if
(
!
gscApiInstance
)
{
console
.
warn
(
'[配置中心] GSC API 实例未初始化,无法更新 Authorization'
);
return
;
}
// 尝试更新 headers(如果 Request 类支持)
// 注意:需要根据 glsk-toolkit 的 Request 类实际 API 调整
try
{
if
(
gscApiInstance
.
headers
)
{
// 如果支持直接更新 headers
gscApiInstance
.
headers
.
Authorization
=
token
?
`Bearer
${
token
}
`
:
''
;
}
else
if
(
gscApiInstance
.
setHeader
)
{
// 如果支持 setHeader 方法
gscApiInstance
.
setHeader
(
'Authorization'
,
token
?
`Bearer
${
token
}
`
:
''
);
}
else
if
(
gscApiInstance
.
updateHeaders
)
{
// 如果支持 updateHeaders 方法
gscApiInstance
.
updateHeaders
({
Authorization
:
token
?
`Bearer
${
token
}
`
:
''
,
});
}
else
{
console
.
warn
(
'[配置中心] Request 实例不支持动态更新 headers'
);
}
}
catch
(
error
)
{
console
.
error
(
'[配置中心] 更新 Authorization 失败:'
,
error
);
}
}
/**
/**
* 等待配置加载完成
* 等待配置加载完成
...
@@ -111,7 +80,7 @@ export async function fetchConfig(): Promise<any> {
...
@@ -111,7 +80,7 @@ export async function fetchConfig(): Promise<any> {
sessionId
:
'd5629aee-28c7-4def-a8fa-95d76c978dc7'
,
sessionId
:
'd5629aee-28c7-4def-a8fa-95d76c978dc7'
,
},
},
headers
:
{
headers
:
{
'Authorization'
:
''
,
'Authorization'
:
'
472b403095cd439d81d258c89267c7db
'
,
'X-App-Version'
:
'1.0.0'
'X-App-Version'
:
'1.0.0'
},
},
events
:
{
events
:
{
...
...
apps/frontend/venus-agentic/venus-agentic-base/src/stores/user.ts
View file @
f3a5f76
...
@@ -10,7 +10,6 @@ import {
...
@@ -10,7 +10,6 @@ import {
import
{
removeToken
,
setToken
}
from
'@/utils/auth'
;
import
{
removeToken
,
setToken
}
from
'@/utils/auth'
;
import
{
defineStore
}
from
'pinia'
;
import
{
defineStore
}
from
'pinia'
;
// 可选:如果使用方案2,需要导入此函数
// 可选:如果使用方案2,需要导入此函数
// import { updateGscApiAuth } from '@/config/center';
/**
/**
* 用户状态管理
* 用户状态管理
...
@@ -47,9 +46,6 @@ export const useUserStore = defineStore('user', () => {
...
@@ -47,9 +46,6 @@ export const useUserStore = defineStore('user', () => {
token
.
value
=
accessToken
;
token
.
value
=
accessToken
;
setToken
(
accessToken
);
setToken
(
accessToken
);
// 可选:如果使用方案2,同步更新 GSC API 的 Authorization header
// updateGscApiAuth(accessToken);
// 登录成功后,自动调用 getUserInfo 获取用户信息并缓存
// 登录成功后,自动调用 getUserInfo 获取用户信息并缓存
try
{
try
{
await
getUserInfo
();
await
getUserInfo
();
...
@@ -86,9 +82,6 @@ export const useUserStore = defineStore('user', () => {
...
@@ -86,9 +82,6 @@ export const useUserStore = defineStore('user', () => {
roles
.
value
=
[];
roles
.
value
=
[];
removeToken
();
removeToken
();
// 可选:如果使用方案2,清空 GSC API 的 Authorization header
// updateGscApiAuth(null);
console
.
log
(
'退出'
);
console
.
log
(
'退出'
);
// 同步清空 qiankun 全局状态中的用户信息
// 同步清空 qiankun 全局状态中的用户信息
syncUserToQiankun
();
syncUserToQiankun
();
...
...
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