mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-03 00:00:58 +08:00
fix: 批量删除apikey
This commit is contained in:
@@ -2,6 +2,23 @@
|
|||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
visible: false,
|
||||||
|
mode: 'create',
|
||||||
|
formData: () => ({
|
||||||
|
name: '',
|
||||||
|
expireTime: '',
|
||||||
|
premiumQuotaLimit: 0,
|
||||||
|
quotaUnit: '万',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'update:visible': [value: boolean];
|
||||||
|
'confirm': [data: TokenFormData | TokenFormData[]];
|
||||||
|
'batchCreate': [items: TokenFormData[], onProgress: (index: number, status: CreateStatus, error?: string) => void];
|
||||||
|
}>();
|
||||||
|
|
||||||
// 最大批量创建数量
|
// 最大批量创建数量
|
||||||
const MAX_BATCH_CREATE_COUNT = 10;
|
const MAX_BATCH_CREATE_COUNT = 10;
|
||||||
|
|
||||||
@@ -29,23 +46,6 @@ interface Props {
|
|||||||
formData?: TokenFormData;
|
formData?: TokenFormData;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
|
||||||
visible: false,
|
|
||||||
mode: 'create',
|
|
||||||
formData: () => ({
|
|
||||||
name: '',
|
|
||||||
expireTime: '',
|
|
||||||
premiumQuotaLimit: 0,
|
|
||||||
quotaUnit: '万',
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
'update:visible': [value: boolean];
|
|
||||||
'confirm': [data: TokenFormData | TokenFormData[]];
|
|
||||||
'batchCreate': [items: TokenFormData[], onProgress: (index: number, status: CreateStatus, error?: string) => void];
|
|
||||||
}>();
|
|
||||||
|
|
||||||
const localFormData = ref<TokenFormData>({
|
const localFormData = ref<TokenFormData>({
|
||||||
name: '',
|
name: '',
|
||||||
expireTime: '',
|
expireTime: '',
|
||||||
@@ -119,7 +119,8 @@ watch(batchCount, (count) => {
|
|||||||
}
|
}
|
||||||
batchNamesText.value = names.join('\n');
|
batchNamesText.value = names.join('\n');
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
batchNamesText.value = '';
|
batchNamesText.value = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -373,7 +374,8 @@ async function handlePreviewConfirm() {
|
|||||||
|
|
||||||
// 预览对话框取消
|
// 预览对话框取消
|
||||||
function handlePreviewCancel() {
|
function handlePreviewCancel() {
|
||||||
if (isCreating.value) return;
|
if (isCreating.value)
|
||||||
|
return;
|
||||||
showPreviewDialog.value = false;
|
showPreviewDialog.value = false;
|
||||||
previewNames.value = [];
|
previewNames.value = [];
|
||||||
createStatusList.value = [];
|
createStatusList.value = [];
|
||||||
@@ -612,9 +614,15 @@ function formatDateTime(dateStr: string | null | undefined) {
|
|||||||
<!-- 创建进度提示 -->
|
<!-- 创建进度提示 -->
|
||||||
<div v-if="isCreating" class="preview-progress-header">
|
<div v-if="isCreating" class="preview-progress-header">
|
||||||
<div class="progress-summary">
|
<div class="progress-summary">
|
||||||
<el-icon v-if="createProgress.pending > 0" class="is-loading"><i-ep-loading /></el-icon>
|
<el-icon v-if="createProgress.pending > 0" class="is-loading">
|
||||||
<el-icon v-else-if="createProgress.failed > 0"><i-ep-circle-close /></el-icon>
|
<i-ep-loading />
|
||||||
<el-icon v-else><i-ep-circle-check /></el-icon>
|
</el-icon>
|
||||||
|
<el-icon v-else-if="createProgress.failed > 0">
|
||||||
|
<i-ep-circle-close />
|
||||||
|
</el-icon>
|
||||||
|
<el-icon v-else>
|
||||||
|
<i-ep-circle-check />
|
||||||
|
</el-icon>
|
||||||
<span>
|
<span>
|
||||||
<template v-if="createProgress.pending > 0">正在创建中...</template>
|
<template v-if="createProgress.pending > 0">正在创建中...</template>
|
||||||
<template v-else-if="createProgress.failed > 0">部分创建失败</template>
|
<template v-else-if="createProgress.failed > 0">部分创建失败</template>
|
||||||
@@ -662,7 +670,9 @@ function formatDateTime(dateStr: string | null | undefined) {
|
|||||||
|
|
||||||
<!-- 配额信息 -->
|
<!-- 配额信息 -->
|
||||||
<div class="preview-section">
|
<div class="preview-section">
|
||||||
<div class="preview-section-title">配额设置</div>
|
<div class="preview-section-title">
|
||||||
|
配额设置
|
||||||
|
</div>
|
||||||
<div class="preview-section-content">
|
<div class="preview-section-content">
|
||||||
<span v-if="unlimitedQuota" class="preview-tag preview-tag-success">无限制</span>
|
<span v-if="unlimitedQuota" class="preview-tag preview-tag-success">无限制</span>
|
||||||
<span v-else class="preview-tag preview-tag-info">
|
<span v-else class="preview-tag preview-tag-info">
|
||||||
@@ -677,7 +687,9 @@ function formatDateTime(dateStr: string | null | undefined) {
|
|||||||
|
|
||||||
<!-- 名称列表 -->
|
<!-- 名称列表 -->
|
||||||
<div class="preview-section">
|
<div class="preview-section">
|
||||||
<div class="preview-section-title">API 密钥名称列表</div>
|
<div class="preview-section-title">
|
||||||
|
API 密钥名称列表
|
||||||
|
</div>
|
||||||
<div class="preview-names-list">
|
<div class="preview-names-list">
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in createStatusList"
|
v-for="(item, index) in createStatusList"
|
||||||
@@ -763,9 +775,8 @@ function formatDateTime(dateStr: string | null | undefined) {
|
|||||||
.form-hint {
|
.form-hint {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
//gap: 6px;
|
||||||
margin-top: 8px;
|
margin: 2px 2px;
|
||||||
padding: 8px 12px;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
background: #f4f4f5;
|
background: #f4f4f5;
|
||||||
|
|||||||
@@ -592,7 +592,7 @@ onMounted(() => {
|
|||||||
{{ model.modelTypeName }}
|
{{ model.modelTypeName }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
<el-tag v-for="item in model.modelApiTypes" :key="item" size="small">
|
<el-tag v-for="item in model.modelApiTypes" :key="item" size="small">
|
||||||
{{ item.modelApiTypeName }}
|
API类型: {{ item.modelApiTypeName }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div class="model-pricing">
|
<div class="model-pricing">
|
||||||
|
|||||||
Reference in New Issue
Block a user