up.
This commit is contained in:
parent
25561d832e
commit
744e6c9de1
@ -93,3 +93,14 @@ export async function checkExistence(
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
>
|
||||
刷新
|
||||
</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-card>
|
||||
@ -41,12 +41,12 @@
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, ref} from '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 {useFormData} from '@/utils/use-form-data';
|
||||
import type {Config} from '@/api/system/config/model';
|
||||
import ConfigFormList from './components/config-form-list.vue';
|
||||
import {toTree} from 'ele-admin-plus';
|
||||
import {EleMessage, toTree} from 'ele-admin-plus';
|
||||
|
||||
defineOptions({name: 'SystemConfigSet'});
|
||||
|
||||
@ -54,6 +54,8 @@ defineOptions({name: 'SystemConfigSet'});
|
||||
const [form, resetFields, assignFields] = useFormData<Config>({});
|
||||
const configList = ref([]);
|
||||
const configLoading = ref(false);
|
||||
const syncLoading = ref(false);
|
||||
|
||||
/** 搜索 */
|
||||
const reload = () => {
|
||||
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 configGroup = ref('');
|
||||
onMounted(async () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user