Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
9217d063
Commit
9217d063
authored
Dec 23, 2024
by
nick zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 应用API调用导出调用明细excel
parent
76c0727f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
request.ts
src/utils/request.ts
+0
-2
api-call-drawer.vue
...g/components/agent-publish/components/api-call-drawer.vue
+14
-4
No files found.
src/utils/request.ts
View file @
9217d063
...
@@ -73,7 +73,6 @@ service.interceptors.request.use(
...
@@ -73,7 +73,6 @@ service.interceptors.request.use(
service
.
interceptors
.
response
.
use
(
service
.
interceptors
.
response
.
use
(
(
response
:
AxiosResponse
)
=>
{
(
response
:
AxiosResponse
)
=>
{
console
.
log
(
'response'
,
response
)
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
return
response
.
data
return
response
.
data
}
}
...
@@ -101,7 +100,6 @@ function http<T>(
...
@@ -101,7 +100,6 @@ function http<T>(
)
{
)
{
/* 请求成功处理函数 */
/* 请求成功处理函数 */
const
successHandler
=
(
res
:
Response
<
T
>
):
Promise
<
Response
<
T
>>
|
Response
<
T
>
=>
{
const
successHandler
=
(
res
:
Response
<
T
>
):
Promise
<
Response
<
T
>>
|
Response
<
T
>
=>
{
console
.
log
(
'successHandler'
,
res
)
if
(
res
.
code
===
0
||
options
?.
ignoreErrorCheck
)
return
res
if
(
res
.
code
===
0
||
options
?.
ignoreErrorCheck
)
return
res
if
(
res
.
code
===
-
10
)
{
if
(
res
.
code
===
-
10
)
{
...
...
src/views/personal-space/personal-app-setting/components/agent-publish/components/api-call-drawer.vue
View file @
9217d063
...
@@ -23,6 +23,7 @@ const isShow = defineModel<boolean>('isShow', { required: true })
...
@@ -23,6 +23,7 @@ const isShow = defineModel<boolean>('isShow', { required: true })
const
apiProfileLoading
=
ref
(
false
)
const
apiProfileLoading
=
ref
(
false
)
const
apiCallDetailLoading
=
ref
(
false
)
const
apiCallDetailLoading
=
ref
(
false
)
const
reportAPIUsageDataLoading
=
ref
(
false
)
const
apiProfileInfo
=
ref
<
ApiProfileInfo
>
({
const
apiProfileInfo
=
ref
<
ApiProfileInfo
>
({
apiKey
:
''
,
apiKey
:
''
,
apiSecret
:
''
,
apiSecret
:
''
,
...
@@ -120,6 +121,8 @@ async function handleUpdateDateRange(_value: [number, number], formattedValue: [
...
@@ -120,6 +121,8 @@ async function handleUpdateDateRange(_value: [number, number], formattedValue: [
}
}
async
function
handleExportAPIChannelPointUsageData
()
{
async
function
handleExportAPIChannelPointUsageData
()
{
reportAPIUsageDataLoading
.
value
=
true
fetchReportAPIChannelPointUsage
({
fetchReportAPIChannelPointUsage
({
reportRequestType
:
'API_CHANNEL_POINT_USAGE'
,
reportRequestType
:
'API_CHANNEL_POINT_USAGE'
,
agentId
:
personalAppConfigStore
.
baseInfo
.
agentId
,
agentId
:
personalAppConfigStore
.
baseInfo
.
agentId
,
...
@@ -129,15 +132,21 @@ async function handleExportAPIChannelPointUsageData() {
...
@@ -129,15 +132,21 @@ async function handleExportAPIChannelPointUsageData() {
endTime
:
selectDateRange
.
value
[
1
],
endTime
:
selectDateRange
.
value
[
1
],
},
},
})
})
.
then
((
res
)
=>
{
.
then
((
data
:
any
)
=>
{
console
.
log
(
res
)
const
blob
=
new
Blob
([
data
],
{
type
:
'application/vnd.ms-excel'
})
const
excelUrl
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
as
any
],
{
type
:
'application/vnd.ms-excel'
}))
const
link
=
document
.
createElement
(
'a'
)
window
.
open
(
excelUrl
)
link
.
href
=
window
.
URL
.
createObjectURL
(
blob
)
link
.
download
=
`
${
personalAppConfigStore
.
baseInfo
.
agentId
}
.xlsx`
link
.
click
()
window
.
URL
.
revokeObjectURL
(
link
.
href
)
window
.
$message
.
success
(
t
(
'common_module.export_successfully'
))
window
.
$message
.
success
(
t
(
'common_module.export_successfully'
))
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
window
.
$message
.
error
(
t
(
'common_module.export_failed'
))
window
.
$message
.
error
(
t
(
'common_module.export_failed'
))
})
})
.
finally
(()
=>
{
reportAPIUsageDataLoading
.
value
=
false
})
}
}
</
script
>
</
script
>
...
@@ -268,6 +277,7 @@ async function handleExportAPIChannelPointUsageData() {
...
@@ -268,6 +277,7 @@ async function handleExportAPIChannelPointUsageData() {
type=
"primary"
type=
"primary"
:bordered=
"false"
:bordered=
"false"
:disabled=
"!apiCallDetailData.length"
:disabled=
"!apiCallDetailData.length"
:loading=
"reportAPIUsageDataLoading"
@
click=
"handleExportAPIChannelPointUsageData"
@
click=
"handleExportAPIChannelPointUsageData"
>
>
{{ t('common_module.export_data') }}
{{ t('common_module.export_data') }}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment