mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-02 15:50:54 +08:00
fix: 批量删除apikey
This commit is contained in:
@@ -2,6 +2,23 @@
|
||||
import { ElMessage } from 'element-plus';
|
||||
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;
|
||||
|
||||
@@ -29,23 +46,6 @@ interface Props {
|
||||
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>({
|
||||
name: '',
|
||||
expireTime: '',
|
||||
@@ -119,7 +119,8 @@ watch(batchCount, (count) => {
|
||||
}
|
||||
batchNamesText.value = names.join('\n');
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
batchNamesText.value = '';
|
||||
}
|
||||
});
|
||||
@@ -373,7 +374,8 @@ async function handlePreviewConfirm() {
|
||||
|
||||
// 预览对话框取消
|
||||
function handlePreviewCancel() {
|
||||
if (isCreating.value) return;
|
||||
if (isCreating.value)
|
||||
return;
|
||||
showPreviewDialog.value = false;
|
||||
previewNames.value = [];
|
||||
createStatusList.value = [];
|
||||
@@ -612,9 +614,15 @@ function formatDateTime(dateStr: string | null | undefined) {
|
||||
<!-- 创建进度提示 -->
|
||||
<div v-if="isCreating" class="preview-progress-header">
|
||||
<div class="progress-summary">
|
||||
<el-icon v-if="createProgress.pending > 0" class="is-loading"><i-ep-loading /></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>
|
||||
<el-icon v-if="createProgress.pending > 0" class="is-loading">
|
||||
<i-ep-loading />
|
||||
</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>
|
||||
<template v-if="createProgress.pending > 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-title">配额设置</div>
|
||||
<div class="preview-section-title">
|
||||
配额设置
|
||||
</div>
|
||||
<div class="preview-section-content">
|
||||
<span v-if="unlimitedQuota" class="preview-tag preview-tag-success">无限制</span>
|
||||
<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-title">API 密钥名称列表</div>
|
||||
<div class="preview-section-title">
|
||||
API 密钥名称列表
|
||||
</div>
|
||||
<div class="preview-names-list">
|
||||
<div
|
||||
v-for="(item, index) in createStatusList"
|
||||
@@ -763,9 +775,8 @@ function formatDateTime(dateStr: string | null | undefined) {
|
||||
.form-hint {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
padding: 8px 12px;
|
||||
//gap: 6px;
|
||||
margin: 2px 2px;
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
background: #f4f4f5;
|
||||
|
||||
@@ -592,7 +592,7 @@ onMounted(() => {
|
||||
{{ model.modelTypeName }}
|
||||
</el-tag>
|
||||
<el-tag v-for="item in model.modelApiTypes" :key="item" size="small">
|
||||
{{ item.modelApiTypeName }}
|
||||
API类型: {{ item.modelApiTypeName }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<div class="model-pricing">
|
||||
|
||||
Reference in New Issue
Block a user