This commit is contained in:
u2nyakim 2025-08-26 10:46:01 +08:00
parent 25561d832e
commit 744e6c9de1
2 changed files with 25 additions and 3 deletions

View File

@ -93,3 +93,14 @@ export async function checkExistence(
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.data.message));
} }
/**
*
*/
export async function syncConfigs() {
const res = await request.put<ApiResult<Config[]>>('/system/config/sync', {});
if (res.data.code === 0 && res.data.data) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}

View File

@ -9,7 +9,7 @@
> >
刷新 刷新
</el-button> </el-button>
<el-button type="danger" class="ele-btn-icon" :icon="Refresh"> <el-button type="danger" class="ele-btn-icon" :icon="Refresh" @click="sync()" :loading="syncLoading">
同步配置 同步配置
</el-button> </el-button>
</el-card> </el-card>
@ -41,12 +41,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import {onMounted, ref} from 'vue'; import {onMounted, ref} from 'vue';
import {Refresh} from '@element-plus/icons-vue'; import {Refresh} from '@element-plus/icons-vue';
import {listConfigs} from '@/api/system/config'; import {listConfigs, syncConfigs} from '@/api/system/config';
import {getSysConfig, strToBind, strToOption} from '@/utils/sys-config'; import {getSysConfig, strToBind, strToOption} from '@/utils/sys-config';
import {useFormData} from '@/utils/use-form-data'; import {useFormData} from '@/utils/use-form-data';
import type {Config} from '@/api/system/config/model'; import type {Config} from '@/api/system/config/model';
import ConfigFormList from './components/config-form-list.vue'; import ConfigFormList from './components/config-form-list.vue';
import {toTree} from 'ele-admin-plus'; import {EleMessage, toTree} from 'ele-admin-plus';
defineOptions({name: 'SystemConfigSet'}); defineOptions({name: 'SystemConfigSet'});
@ -54,6 +54,8 @@ defineOptions({name: 'SystemConfigSet'});
const [form, resetFields, assignFields] = useFormData<Config>({}); const [form, resetFields, assignFields] = useFormData<Config>({});
const configList = ref([]); const configList = ref([]);
const configLoading = ref(false); const configLoading = ref(false);
const syncLoading = ref(false);
/** 搜索 */ /** 搜索 */
const reload = () => { const reload = () => {
configLoading.value = true; configLoading.value = true;
@ -75,6 +77,15 @@ const reload = () => {
}); });
}; };
const sync = () => {
syncLoading.value = true;
syncConfigs().then(()=>{
EleMessage.success("同步成功");
}).finally(()=>{
syncLoading.value = false;
});
}
const groupItems = ref([]); const groupItems = ref([]);
const configGroup = ref(''); const configGroup = ref('');
onMounted(async () => { onMounted(async () => {