前端和json优化

This commit is contained in:
2025-11-28 17:16:17 +08:00
parent 34e69c7f62
commit dfb11c85f1
135 changed files with 930 additions and 633 deletions

View File

@@ -313,6 +313,7 @@ function handleJumpPage() {
<style lang="scss" scoped>
.login-logs {
background-color: #FFFFFF;
padding: 20px;
}

View File

@@ -385,6 +385,7 @@ function handleSizeChange(size: number) {
<style lang="scss" scoped>
.operation-logs {
background-color: #FFFFFF;
padding: 20px;
}

View File

@@ -197,20 +197,42 @@ function getRenderType(item: ConfigItem): string {
}
/**
* 解析 options JSON 字符串
* @param optionsStr JSON 字符串
* 解析 options 字符串支持JSON数组和逗号分隔字符串
* @param optionsStr JSON 字符串或逗号分隔的字符串
* @returns 选项数组
*/
function parseOptions(optionsStr?: string): Array<{ label: string; value: any }> {
if (!optionsStr) {
return [];
}
try {
// 尝试解析为JSON
const parsed = JSON.parse(optionsStr);
return Array.isArray(parsed) ? parsed : [];
} catch (error) {
console.warn('解析 options 失败:', error);
if (Array.isArray(parsed)) {
return parsed;
}
return [];
} catch (error) {
// 如果JSON解析失败尝试作为逗号分隔的字符串处理
// 格式:'aliyun,tencent' 或 'aliyun:阿里云,tencent:腾讯云'
const items = optionsStr.split(',').map(item => item.trim()).filter(item => item);
return items.map(item => {
// 检查是否包含冒号分隔符 (value:label 格式)
const parts = item.split(':');
if (parts.length === 2) {
return {
value: parts[0].trim(),
label: parts[1].trim()
};
}
// 如果没有冒号value和label相同
return {
value: item,
label: item
};
});
}
}
@@ -346,11 +368,12 @@ async function saveConfig(groupKey: string) {
<style lang="scss" scoped>
.system-config {
background-color: #FFFFFF;
padding: 20px;
:deep(.el-tabs--border-card) {
border: none;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
// box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
:deep(.el-tabs__content) {