style: Auto配置页面改用Tailwind CSS风格,与其他页面保持一致
This commit is contained in:
@@ -4,123 +4,138 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Auto配置管理 - LLM Proxy</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
|
||||
<style>
|
||||
body { background-color: #f8f9fa; }
|
||||
.provider-item { cursor: move; transition: all 0.2s; }
|
||||
.provider-item:hover { background-color: #f0f0f0; }
|
||||
.provider-item.selected { border-color: #198754; background-color: #f0fff0; }
|
||||
.provider-item.disabled { opacity: 0.5; }
|
||||
.drag-handle { cursor: grab; }
|
||||
.profile-card { transition: all 0.2s; }
|
||||
.profile-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
|
||||
.gradient-bg { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); }
|
||||
.dragging { opacity: 0.5; transform: scale(1.02); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/">
|
||||
<i class="bi bi-cpu"></i> LLM Proxy Admin
|
||||
</a>
|
||||
<div class="navbar-nav ms-auto">
|
||||
<a class="nav-link" href="/">仪表盘</a>
|
||||
<a class="nav-link" href="/providers">提供商</a>
|
||||
<a class="nav-link" href="/models">模型</a>
|
||||
<a class="nav-link active" href="/auto-profiles">Auto配置</a>
|
||||
<a class="nav-link" href="/logs">日志</a>
|
||||
<a class="nav-link" href="/config">配置</a>
|
||||
<body class="bg-gray-50 min-h-screen">
|
||||
<div class="flex">
|
||||
<aside class="w-64 bg-slate-800 min-h-screen fixed left-0 top-0">
|
||||
<div class="p-6">
|
||||
<h1 class="text-white text-xl font-bold flex items-center gap-2">
|
||||
<i class="ri-route-line text-2xl text-purple-400"></i>
|
||||
LLM Proxy
|
||||
</h1>
|
||||
<p class="text-slate-400 text-sm mt-1">后台管理</p>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<nav class="mt-6">
|
||||
<a href="/" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
||||
<i class="ri-dashboard-line"></i><span>仪表盘</span>
|
||||
</a>
|
||||
<a href="/providers" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
||||
<i class="ri-server-line"></i><span>提供商管理</span>
|
||||
</a>
|
||||
<a href="/models" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
||||
<i class="ri-cpu-line"></i><span>模型管理</span>
|
||||
</a>
|
||||
<a href="/auto-profiles" class="flex items-center gap-3 px-6 py-3 bg-slate-700 text-white">
|
||||
<i class="ri-shuffle-line"></i><span>Auto配置</span>
|
||||
</a>
|
||||
<a href="/logs" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
||||
<i class="ri-file-list-line"></i><span>日志查看</span>
|
||||
</a>
|
||||
<a href="/config" class="flex items-center gap-3 px-6 py-3 text-slate-300 hover:bg-slate-700 hover:text-white">
|
||||
<i class="ri-settings-3-line"></i><span>系统配置</span>
|
||||
</a>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<div class="container py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4><i class="bi bi-shuffle"></i> Auto配置管理</h4>
|
||||
<button class="btn btn-primary" onclick="showCreateModal()">
|
||||
<i class="bi bi-plus-lg"></i> 创建Auto配置
|
||||
</button>
|
||||
</div>
|
||||
<main class="ml-64 flex-1 p-8">
|
||||
<!-- 顶部操作栏 -->
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-gray-800">Auto配置管理</h1>
|
||||
<p class="text-gray-500 text-sm mt-1">创建自定义的自动选择模式,指定候选提供商和优先级</p>
|
||||
</div>
|
||||
<button onclick="showCreateModal()" class="px-4 py-2 gradient-bg text-white rounded-lg hover:opacity-90 transition">
|
||||
<i class="ri-add-line mr-1"></i> 创建Auto配置
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<i class="bi bi-info-circle"></i>
|
||||
<strong>Auto配置</strong>允许您创建自定义的自动选择模式,指定哪些提供商参与选择以及优先级顺序。
|
||||
例如:<code>auto-fast</code> 只选择响应快的模型,<code>auto-cheap</code> 只选择便宜的模型。
|
||||
</div>
|
||||
<!-- 说明卡片 -->
|
||||
<div class="mb-6 p-4 bg-indigo-50 rounded-lg text-sm text-indigo-600">
|
||||
<i class="ri-information-line mr-1"></i>
|
||||
<strong>Auto配置:</strong>创建自定义的模型自动选择模式。例如 <code>model="auto-fast"</code> 只选择响应快的提供商,<code>model="auto-cheap"</code> 只选择便宜的提供商。
|
||||
</div>
|
||||
|
||||
<div id="profilesList" class="row">
|
||||
<div class="col-12 text-center py-4">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
<p class="mt-2">加载中...</p>
|
||||
<!-- 配置列表 -->
|
||||
<div id="profilesList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<p class="text-gray-500 col-span-full text-center py-8">加载中...</p>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<!-- 创建/编辑弹窗 -->
|
||||
<div id="editModal" class="fixed inset-0 bg-black/50 hidden items-center justify-center z-50 p-4">
|
||||
<div class="bg-white rounded-xl w-full max-w-2xl max-h-[90vh] overflow-hidden flex flex-col">
|
||||
<div class="p-6 border-b flex justify-between items-center">
|
||||
<h2 class="text-xl font-bold text-gray-800" id="modalTitle">创建Auto配置</h2>
|
||||
<button onclick="closeModal()" class="text-gray-400 hover:text-gray-600">
|
||||
<i class="ri-close-line text-2xl"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="p-6 overflow-y-auto flex-1">
|
||||
<form id="profileForm">
|
||||
<input type="hidden" id="profileId">
|
||||
|
||||
<div class="grid grid-cols-2 gap-4 mb-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">配置名称</label>
|
||||
<input type="text" id="profileName" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"
|
||||
placeholder="例如: auto-fast, auto-cheap">
|
||||
<p class="text-xs text-gray-500 mt-1">调用时使用 model="此名称"</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">显示名称</label>
|
||||
<input type="text" id="displayName" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"
|
||||
placeholder="例如: 快速模式">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">描述</label>
|
||||
<textarea id="profileDesc" rows="2" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"
|
||||
placeholder="描述这个配置的用途"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">选择策略</label>
|
||||
<select id="profileStrategy" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
||||
<option value="priority">按优先级选择(推荐)</option>
|
||||
<option value="random">随机选择</option>
|
||||
</select>
|
||||
<p class="text-xs text-gray-500 mt-1">按优先级会选择列表中第一个可用的提供商</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">候选提供商(可拖拽调整优先级)</label>
|
||||
<div id="providerList" class="border border-gray-200 rounded-lg p-3 space-y-2 min-h-[100px] bg-gray-50">
|
||||
<!-- 提供商列表 -->
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 mt-1">勾选参与自动选择的提供商,拖拽调整优先级</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="p-6 border-t bg-gray-50 flex justify-end gap-3">
|
||||
<button onclick="closeModal()" class="px-4 py-2 text-gray-600 hover:text-gray-800 transition">取消</button>
|
||||
<button onclick="saveProfile()" class="px-4 py-2 gradient-bg text-white rounded-lg hover:opacity-90 transition">
|
||||
<i class="ri-save-line mr-1"></i> 保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 创建/编辑模态框 -->
|
||||
<div class="modal fade" id="profileModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalTitle">创建Auto配置</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="profileForm">
|
||||
<input type="hidden" id="profileId">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">配置名称</label>
|
||||
<input type="text" class="form-control" id="profileName"
|
||||
placeholder="例如: auto-fast, auto-cheap" required>
|
||||
<small class="text-muted">模型调用时使用此名称,如 model="auto-fast"</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">显示名称</label>
|
||||
<input type="text" class="form-control" id="displayName"
|
||||
placeholder="例如: 快速模式, 经济模式">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">描述</label>
|
||||
<textarea class="form-control" id="profileDesc" rows="2"
|
||||
placeholder="描述这个Auto配置的用途"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">选择策略</label>
|
||||
<select class="form-select" id="profileStrategy">
|
||||
<option value="priority">按优先级(推荐)</option>
|
||||
<option value="random">随机选择</option>
|
||||
</select>
|
||||
<small class="text-muted">按优先级会选择列表中第一个可用的提供商</small>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">候选提供商(拖拽调整优先级)</label>
|
||||
<div id="providerList" class="border rounded p-2" style="min-height: 100px;">
|
||||
<!-- 提供商列表将通过JS加载 -->
|
||||
</div>
|
||||
<small class="text-muted">勾选参与自动选择的提供商,拖拽调整优先级</small>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" onclick="saveProfile()">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
|
||||
<script>
|
||||
let providers = [];
|
||||
let profiles = [];
|
||||
|
||||
// 加载提供商和配置
|
||||
// 加载数据
|
||||
async function loadData() {
|
||||
const [providersRes, profilesRes] = await Promise.all([
|
||||
fetch('/api/providers'),
|
||||
@@ -139,67 +154,73 @@
|
||||
|
||||
if (profiles.length === 0) {
|
||||
container.innerHTML = `
|
||||
<div class="col-12 text-center py-4 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2">暂无Auto配置</p>
|
||||
<div class="col-span-full text-center py-12">
|
||||
<i class="ri-inbox-line text-4xl text-gray-300"></i>
|
||||
<p class="text-gray-500 mt-2">暂无Auto配置</p>
|
||||
<button onclick="showCreateModal()" class="mt-4 px-4 py-2 gradient-bg text-white rounded-lg">
|
||||
<i class="ri-add-line mr-1"></i> 创建第一个配置
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
return;
|
||||
}
|
||||
|
||||
container.innerHTML = profiles.map(profile => `
|
||||
<div class="col-md-6 col-lg-4 mb-3">
|
||||
<div class="card profile-card h-100">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h6 class="mb-0">
|
||||
<code>${profile.name}</code>
|
||||
${profile.name === 'auto' ? '<span class="badge bg-secondary ms-2">默认</span>' : ''}
|
||||
</h6>
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown">
|
||||
<i class="bi bi-three-dots"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#" onclick="editProfile('${profile.name}')">
|
||||
<i class="bi bi-pencil"></i> 编辑
|
||||
</a></li>
|
||||
${profile.name !== 'auto' ? `
|
||||
<li><a class="dropdown-item text-danger" href="#" onclick="deleteProfile('${profile.name}')">
|
||||
<i class="bi bi-trash"></i> 删除
|
||||
</a></li>
|
||||
` : ''}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="bg-white rounded-xl border border-gray-200 hover:shadow-md transition">
|
||||
<div class="p-4 border-b flex justify-between items-center">
|
||||
<div>
|
||||
<code class="text-indigo-600 font-semibold">${profile.name}</code>
|
||||
${profile.name === 'auto' ? '<span class="ml-2 px-2 py-0.5 bg-gray-100 text-gray-600 text-xs rounded">默认</span>' : ''}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h6 class="card-title">${profile.display_name || profile.name}</h6>
|
||||
<p class="card-text small text-muted">${profile.description || '暂无描述'}</p>
|
||||
<div class="mt-2">
|
||||
<span class="badge bg-info">${profile.strategy === 'priority' ? '按优先级' : '随机'}</span>
|
||||
<span class="badge bg-secondary">${profile.provider_details?.length || 0} 个提供商</span>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
${profile.provider_details?.slice(0, 3).map(p =>
|
||||
`<span class="badge bg-light text-dark me-1">${p.name}</span>`
|
||||
).join('') || ''}
|
||||
${(profile.provider_details?.length || 0) > 3 ?
|
||||
`<span class="text-muted small">+${profile.provider_details.length - 3} 更多</span>` : ''}
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
${profile.name !== 'auto' ? `
|
||||
<button onclick="editProfile('${profile.name}')" class="p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition">
|
||||
<i class="ri-pencil-line"></i>
|
||||
</button>
|
||||
<button onclick="deleteProfile('${profile.name}')" class="p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition">
|
||||
<i class="ri-delete-bin-line"></i>
|
||||
</button>
|
||||
` : `
|
||||
<button onclick="editProfile('${profile.name}')" class="p-2 text-gray-400 hover:text-indigo-600 hover:bg-indigo-50 rounded-lg transition">
|
||||
<i class="ri-pencil-line"></i>
|
||||
</button>
|
||||
`}
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<h3 class="font-medium text-gray-800">${profile.display_name || profile.name}</h3>
|
||||
<p class="text-sm text-gray-500 mt-1">${profile.description || '暂无描述'}</p>
|
||||
<div class="flex gap-2 mt-3">
|
||||
<span class="px-2 py-1 bg-indigo-50 text-indigo-600 text-xs rounded">
|
||||
${profile.strategy === 'priority' ? '按优先级' : '随机'}
|
||||
</span>
|
||||
<span class="px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded">
|
||||
${profile.provider_details?.length || 0} 个提供商
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt-3 flex flex-wrap gap-1">
|
||||
${profile.provider_details?.slice(0, 4).map(p =>
|
||||
`<span class="px-2 py-0.5 bg-slate-100 text-slate-600 text-xs rounded">${p.name}</span>`
|
||||
).join('') || ''}
|
||||
${(profile.provider_details?.length || 0) > 4 ?
|
||||
`<span class="text-xs text-gray-400">+${profile.provider_details.length - 4}</span>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// 显示创建模态框
|
||||
// 显示创建弹窗
|
||||
function showCreateModal() {
|
||||
document.getElementById('modalTitle').textContent = '创建Auto配置';
|
||||
document.getElementById('profileId').value = '';
|
||||
document.getElementById('profileForm').reset();
|
||||
document.getElementById('profileName').disabled = false;
|
||||
|
||||
renderProviderList([]);
|
||||
|
||||
new bootstrap.Modal(document.getElementById('profileModal')).show();
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
document.getElementById('editModal').classList.add('flex');
|
||||
}
|
||||
|
||||
// 编辑配置
|
||||
@@ -217,7 +238,14 @@
|
||||
|
||||
renderProviderList(profile.provider_details || []);
|
||||
|
||||
new bootstrap.Modal(document.getElementById('profileModal')).show();
|
||||
document.getElementById('editModal').classList.remove('hidden');
|
||||
document.getElementById('editModal').classList.add('flex');
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
function closeModal() {
|
||||
document.getElementById('editModal').classList.add('hidden');
|
||||
document.getElementById('editModal').classList.remove('flex');
|
||||
}
|
||||
|
||||
// 渲染提供商列表
|
||||
@@ -225,7 +253,6 @@
|
||||
const container = document.getElementById('providerList');
|
||||
const selectedIds = selectedProviders.map(p => p.id);
|
||||
|
||||
// 按 priority 排序
|
||||
const sortedProviders = [...providers].sort((a, b) => a.priority - b.priority);
|
||||
|
||||
container.innerHTML = sortedProviders.map(p => {
|
||||
@@ -233,26 +260,21 @@
|
||||
const isAll = p.id === '*';
|
||||
|
||||
return `
|
||||
<div class="provider-item border rounded p-2 mb-2 ${isSelected ? 'selected' : ''} ${isAll ? 'bg-light' : ''}"
|
||||
<div class="flex items-center gap-3 p-3 bg-white rounded-lg border ${isSelected ? 'border-indigo-500 bg-indigo-50' : 'border-gray-200'} hover:border-indigo-300 transition cursor-move"
|
||||
data-id="${p.id}" data-priority="${p.priority}">
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="bi bi-grip-vertical drag-handle me-2 text-muted"></i>
|
||||
<div class="form-check me-3">
|
||||
<input type="checkbox" class="form-check-input provider-check"
|
||||
id="provider-${p.id}" ${isSelected ? 'checked' : ''}
|
||||
${isAll ? 'onchange="toggleAllProviders(this)"' : ''}>
|
||||
<i class="ri-drag-move-2 text-gray-400 cursor-grab"></i>
|
||||
<input type="checkbox" class="provider-check w-4 h-4 text-indigo-600 rounded"
|
||||
id="provider-${p.id}" ${isSelected ? 'checked' : ''}
|
||||
onchange="this.closest('[data-id]').classList.toggle('border-indigo-500', this.checked);this.closest('[data-id]').classList.toggle('bg-indigo-50', this.checked)">
|
||||
<div class="flex-1 min-w-0">
|
||||
<div class="font-medium text-gray-800 truncate">${p.name}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
优先级 ${p.priority} · ${p.models?.slice(0, 2).join(', ')}${p.models?.length > 2 ? '...' : ''}
|
||||
</div>
|
||||
<div class="flex-grow-1">
|
||||
<div class="fw-bold">${p.name}</div>
|
||||
<small class="text-muted">
|
||||
优先级: ${p.priority} |
|
||||
模型: ${p.models?.slice(0, 2).join(', ')}${p.models?.length > 2 ? '...' : ''}
|
||||
</small>
|
||||
</div>
|
||||
${p.available ?
|
||||
'<span class="badge bg-success">可用</span>' :
|
||||
'<span class="badge bg-danger">不可用</span>'}
|
||||
</div>
|
||||
${p.available ?
|
||||
'<span class="px-2 py-0.5 bg-green-100 text-green-700 text-xs rounded">可用</span>' :
|
||||
'<span class="px-2 py-0.5 bg-red-100 text-red-700 text-xs rounded">不可用</span>'}
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
@@ -260,19 +282,8 @@
|
||||
// 初始化拖拽排序
|
||||
new Sortable(container, {
|
||||
animation: 150,
|
||||
handle: '.drag-handle',
|
||||
ghostClass: 'bg-info bg-opacity-10',
|
||||
});
|
||||
}
|
||||
|
||||
// 切换所有提供商
|
||||
function toggleAllProviders(checkbox) {
|
||||
const checks = document.querySelectorAll('.provider-check');
|
||||
checks.forEach(c => {
|
||||
if (c.id !== 'provider-*') {
|
||||
c.checked = checkbox.checked;
|
||||
c.closest('.provider-item').classList.toggle('selected', checkbox.checked);
|
||||
}
|
||||
handle: '.ri-drag-move-2',
|
||||
ghostClass: 'dragging',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -290,17 +301,9 @@
|
||||
|
||||
// 收集选中的提供商
|
||||
const selectedProviders = [];
|
||||
const allCheckbox = document.getElementById('provider-*');
|
||||
|
||||
if (allCheckbox?.checked) {
|
||||
selectedProviders.push('*');
|
||||
} else {
|
||||
document.querySelectorAll('.provider-check:checked').forEach(c => {
|
||||
if (c.id !== 'provider-*') {
|
||||
selectedProviders.push(c.dataset?.id || c.id.replace('provider-', ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
document.querySelectorAll('.provider-check:checked').forEach(c => {
|
||||
selectedProviders.push(c.id.replace('provider-', ''));
|
||||
});
|
||||
|
||||
const data = {
|
||||
name: profileName,
|
||||
@@ -324,7 +327,7 @@
|
||||
const result = await res.json();
|
||||
|
||||
if (result.success) {
|
||||
bootstrap.Modal.getInstance(document.getElementById('profileModal')).hide();
|
||||
closeModal();
|
||||
loadData();
|
||||
} else {
|
||||
alert('保存失败: ' + (result.error || '未知错误'));
|
||||
|
||||
Reference in New Issue
Block a user