Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4655fb4b
authored
Jul 14, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户资源包列表修改
parent
0bf3c8de
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
20 deletions
+79
-20
src/api/apihub/userapiusage/index.ts
+2
-0
src/views/apihub/api/ApiForm.vue
+0
-0
src/views/apihub/userapiusage/UserApiUsageDetail.vue
+46
-0
src/views/apihub/userapiusage/index.vue
+31
-20
No files found.
src/api/apihub/userapiusage/index.ts
View file @
4655fb4b
...
@@ -5,6 +5,8 @@ import type { Dayjs } from 'dayjs';
...
@@ -5,6 +5,8 @@ import type { Dayjs } from 'dayjs';
export
interface
UserApiUsage
{
export
interface
UserApiUsage
{
id
:
number
;
// 记录ID
id
:
number
;
// 记录ID
userId
?:
number
;
// 用户ID
userId
?:
number
;
// 用户ID
userMobile
?:
string
;
// 用户手机号
userNickname
?:
string
;
// 用户昵称
apiId
?:
number
;
// API ID
apiId
?:
number
;
// API ID
apiName
?:
string
;
// api名称
apiName
?:
string
;
// api名称
packageId
?:
number
;
// 购买的套餐ID
packageId
?:
number
;
// 购买的套餐ID
...
...
src/views/apihub/api/ApiForm.vue
View file @
4655fb4b
This diff is collapsed.
Click to expand it.
src/views/apihub/userapiusage/UserApiUsageDetail.vue
0 → 100644
View file @
4655fb4b
<
template
>
<el-dialog
title=
"资源包详情"
v-model=
"visible"
width=
"700px"
>
<el-descriptions
:column=
"2"
border
v-loading=
"loading"
>
<el-descriptions-item
label=
"用户手机号"
>
{{
detailData
.
userMobile
||
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"用户昵称"
>
{{
detailData
.
userNickname
||
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"API名称"
>
{{
detailData
.
apiName
||
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"套餐名称"
>
{{
detailData
.
packageName
||
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"套餐总量"
>
{{
detailData
.
packageTimes
??
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"有效时长"
>
{{
detailData
.
packageValidDays
?
detailData
.
packageValidDays
+
' 天'
:
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"已使用次数"
>
{{
detailData
.
usedTimes
??
'-'
}}
</el-descriptions-item>
<el-descriptions-item
label=
"过期时间"
>
{{
formatDate
(
detailData
.
expireTime
)
}}
</el-descriptions-item>
<el-descriptions-item
label=
"购买时间"
>
{{
formatDate
(
detailData
.
createTime
)
}}
</el-descriptions-item>
</el-descriptions>
</el-dialog>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
UserApiUsageApi
}
from
'@/api/apihub/userapiusage'
const
visible
=
ref
(
false
)
const
loading
=
ref
(
false
)
const
detailData
=
ref
<
any
>
({})
const
formatDate
=
(
date
:
string
)
=>
{
if
(
!
date
)
return
'-'
const
d
=
new
Date
(
date
)
if
(
isNaN
(
d
.
getTime
()))
return
date
const
pad
=
(
n
:
number
)
=>
n
.
toString
().
padStart
(
2
,
'0'
)
return
`
${
d
.
getFullYear
()}
-
${
pad
(
d
.
getMonth
()
+
1
)}
-
${
pad
(
d
.
getDate
())}
${
pad
(
d
.
getHours
())}
:
${
pad
(
d
.
getMinutes
())}
:
${
pad
(
d
.
getSeconds
())}
`
}
const
open
=
async
(
id
:
number
)
=>
{
visible
.
value
=
true
loading
.
value
=
true
try
{
const
data
=
await
UserApiUsageApi
.
getUserApiUsage
(
id
)
detailData
.
value
=
data
}
finally
{
loading
.
value
=
false
}
}
defineExpose
({
open
})
</
script
>
src/views/apihub/userapiusage/index.vue
View file @
4655fb4b
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
>
>
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
</el-button>
</el-button>
<el-button
<
!--
<
el-button
type=
"danger"
type=
"danger"
plain
plain
:disabled=
"isEmpty(checkedIds)"
:disabled=
"isEmpty(checkedIds)"
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
v-hasPermi=
"['apihub:user-api-usage:delete']"
v-hasPermi=
"['apihub:user-api-usage:delete']"
>
>
<Icon
icon=
"ep:delete"
class=
"mr-5px"
/>
批量删除
<Icon
icon=
"ep:delete"
class=
"mr-5px"
/>
批量删除
</el-button>
</el-button>
-->
</el-form-item>
</el-form-item>
</el-form>
</el-form>
</ContentWrap>
</ContentWrap>
...
@@ -64,23 +64,23 @@
...
@@ -64,23 +64,23 @@
<!-- 列表 -->
<!-- 列表 -->
<ContentWrap>
<ContentWrap>
<el-table
<el-table
row-key=
"id"
row-key=
"id"
v-loading=
"loading"
v-loading=
"loading"
:data=
"list"
:data=
"list"
:stripe=
"true"
:stripe=
"true"
:show-overflow-tooltip=
"true"
:show-overflow-tooltip=
"true"
@
selection-change=
"handleRowCheckboxChange"
@
selection-change=
"handleRowCheckboxChange"
>
>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
type=
"selection"
width=
"55"
/>
<el-table-column
label=
"用户手机号"
align=
"center"
prop=
"userMobile"
width=
"150px"
/>
<el-table-column
label=
"用户手机号"
align=
"center"
prop=
"userMobile"
width=
"150px"
/>
<el-table-column
label=
"用户昵称"
align=
"center"
prop=
"userNickname"
width=
"150px"
/>
<el-table-column
label=
"api名称"
align=
"center"
prop=
"apiName"
width=
"150px"
/>
<el-table-column
label=
"api名称"
align=
"center"
prop=
"apiName"
width=
"150px"
/>
<el-table-column
label=
"套餐名称"
align=
"center"
prop=
"packageName"
width=
"150px"
/>
<el-table-column
label=
"套餐名称"
align=
"center"
prop=
"packageName"
width=
"150px"
/>
<el-table-column
label=
"套餐总量"
align=
"center"
prop=
"packageTimes"
/>
<el-table-column
label=
"套餐总量"
align=
"center"
prop=
"packageTimes"
/>
<el-table-column
label=
"有效时长"
align=
"center"
prop=
"packageValidDays"
>
<el-table-column
label=
"有效时长"
align=
"center"
prop=
"packageValidDays"
>
<template
#
default=
"scope"
>
<template
#
default=
"scope"
>
{{
scope
.
row
.
packageValidDays
}}
天
</
template
>
{{
scope
.
row
.
packageValidDays
}}
天
</el-table-column>
</
template
>
<el-table-column
label=
"已使用次数"
align=
"center"
prop=
"usedTimes"
width=
"150px"
/>
</el-table-column>
<el-table-column
label=
"已使用次数"
align=
"center"
prop=
"usedTimes"
width=
"150px"
/>
<el-table-column
<el-table-column
label=
"过期时间"
label=
"过期时间"
align=
"center"
align=
"center"
...
@@ -95,9 +95,10 @@
...
@@ -95,9 +95,10 @@
:formatter=
"dateFormatter"
:formatter=
"dateFormatter"
width=
"180px"
width=
"180px"
/>
/>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"1
2
0px"
>
<el-table-column
label=
"操作"
align=
"center"
min-width=
"1
8
0px"
>
<
template
#
default=
"scope"
>
<
template
#
default=
"scope"
>
<el-button
<el-button
link
type=
"primary"
@
click=
"handleDetail(scope.row.id)"
>
详情
</el-button>
<!--
<el-button
link
link
type=
"primary"
type=
"primary"
@
click=
"openForm('update', scope.row.id)"
@
click=
"openForm('update', scope.row.id)"
...
@@ -112,7 +113,7 @@
...
@@ -112,7 +113,7 @@
v-hasPermi=
"['apihub:user-api-usage:delete']"
v-hasPermi=
"['apihub:user-api-usage:delete']"
>
>
删除
删除
</el-button>
</el-button>
-->
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -125,6 +126,9 @@
...
@@ -125,6 +126,9 @@
/>
/>
</ContentWrap>
</ContentWrap>
<!-- 详情弹窗 -->
<UserApiUsageDetail
ref=
"detailRef"
/>
<!-- 表单弹窗:添加/修改 -->
<!-- 表单弹窗:添加/修改 -->
<UserApiUsageForm
ref=
"formRef"
@
success=
"getList"
/>
<UserApiUsageForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
</template>
...
@@ -135,6 +139,7 @@ import { dateFormatter } from '@/utils/formatTime'
...
@@ -135,6 +139,7 @@ import { dateFormatter } from '@/utils/formatTime'
import
download
from
'@/utils/download'
import
download
from
'@/utils/download'
import
{
UserApiUsageApi
,
UserApiUsage
}
from
'@/api/apihub/userapiusage'
import
{
UserApiUsageApi
,
UserApiUsage
}
from
'@/api/apihub/userapiusage'
import
UserApiUsageForm
from
'./UserApiUsageForm.vue'
import
UserApiUsageForm
from
'./UserApiUsageForm.vue'
import
UserApiUsageDetail
from
'./UserApiUsageDetail.vue'
/** 用户API管理 列表 */
/** 用户API管理 列表 */
defineOptions
({
name
:
'UserApiUsage'
})
defineOptions
({
name
:
'UserApiUsage'
})
...
@@ -185,6 +190,12 @@ const openForm = (type: string, id?: number) => {
...
@@ -185,6 +190,12 @@ const openForm = (type: string, id?: number) => {
formRef
.
value
.
open
(
type
,
id
)
formRef
.
value
.
open
(
type
,
id
)
}
}
/** 详情操作 */
const
detailRef
=
ref
()
const
handleDetail
=
(
id
:
number
)
=>
{
detailRef
.
value
.
open
(
id
)
}
/** 删除按钮操作 */
/** 删除按钮操作 */
const
handleDelete
=
async
(
id
:
number
)
=>
{
const
handleDelete
=
async
(
id
:
number
)
=>
{
try
{
try
{
...
@@ -203,15 +214,15 @@ const handleDeleteBatch = async () => {
...
@@ -203,15 +214,15 @@ const handleDeleteBatch = async () => {
try
{
try
{
// 删除的二次确认
// 删除的二次确认
await
message
.
delConfirm
()
await
message
.
delConfirm
()
await
UserApiUsageApi
.
deleteUserApiUsageList
(
checkedIds
.
value
)
;
await
UserApiUsageApi
.
deleteUserApiUsageList
(
checkedIds
.
value
)
message
.
success
(
t
(
'common.delSuccess'
))
message
.
success
(
t
(
'common.delSuccess'
))
await
getList
()
;
await
getList
()
}
catch
{}
}
catch
{}
}
}
const
checkedIds
=
ref
<
number
[]
>
([])
const
checkedIds
=
ref
<
number
[]
>
([])
const
handleRowCheckboxChange
=
(
records
:
UserApiUsage
[])
=>
{
const
handleRowCheckboxChange
=
(
records
:
UserApiUsage
[])
=>
{
checkedIds
.
value
=
records
.
map
((
item
)
=>
item
.
id
)
;
checkedIds
.
value
=
records
.
map
((
item
)
=>
item
.
id
)
}
}
/** 导出按钮操作 */
/** 导出按钮操作 */
...
...
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