Files
mokeegateway/_backup_20260613/SystemConfig.vue
2026-07-15 16:13:27 +08:00

86 lines
2.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
系统配置页
功能配置文件对象存储的磁盘路径
数据来源GET /zgapi/v1/admin/config/list POST /zgapi/v1/admin/config/save
-->
<template>
<div class="config-page">
<!-- 文件对象存储配置 -->
<el-card shadow="never">
<template #header>
<div class="card-header-title">
<el-icon><FolderOpened /></el-icon>
<span>文件对象存储配置</span>
</div>
</template>
<el-form ref="formRef" :model="form" label-width="120px" style="max-width: 600px">
<el-form-item label="存储磁盘路径">
<el-input
v-model="form.diskPath"
placeholder="如: /data/mokee/gw/file"
clearable
/>
</el-form-item>
<el-form-item>
<el-button type="primary" :loading="saving" @click="handleSave">
<el-icon><Check /></el-icon>
保存配置
</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { FolderOpened, Check } from '@element-plus/icons-vue'
import request from '@/utils/request'
const saving = ref(false)
const form = reactive({ diskPath: '' })
onMounted(async () => {
try {
const res = await request.get('/zgapi/v1/admin/config/list')
const list: any[] = res.data ?? []
const diskCfg = list.find((c: any) => c.configKey === 'file.storage.disk.path')
if (diskCfg) {
form.diskPath = diskCfg.configValue || ''
}
} catch { /* ignore */ }
})
async function handleSave() {
saving.value = true
try {
await request.post('/zgapi/v1/admin/config/save', {
configKey: 'file.storage.disk.path',
configValue: form.diskPath,
description: '文件对象存储磁盘根目录',
})
ElMessage.success('保存成功')
} catch { /* 拦截器已提示 */ } finally {
saving.value = false
}
}
</script>
<style scoped>
.config-page {
max-width: 700px;
}
.card-header-title {
display: flex;
align-items: center;
gap: 8px;
font-weight: 600;
font-size: 14px;
color: var(--text-primary);
}
</style>