up. 配置更新
This commit is contained in:
parent
8d0c13dcaf
commit
cd411674e6
@ -122,6 +122,18 @@ class ConfigController extends BaseController
|
|||||||
return $this->writeSuccess('同步成功');
|
return $this->writeSuccess('同步成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateData()
|
||||||
|
{
|
||||||
|
$data = $this->request->put();
|
||||||
|
foreach ($data as $name=>$value) {
|
||||||
|
if($name) {
|
||||||
|
$config = SysConfig::where('name', $name)->find();
|
||||||
|
$config && $config->save(['value'=> (string)$value]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->writeSuccess('同步成功');
|
||||||
|
}
|
||||||
|
|
||||||
public function info()
|
public function info()
|
||||||
{
|
{
|
||||||
$table_php = SysConfig::where(['status'=>1])->order(['name'=>'asc'])
|
$table_php = SysConfig::where(['status'=>1])->order(['name'=>'asc'])
|
||||||
|
|||||||
@ -76,6 +76,7 @@ Route::group("adminapi", function () {
|
|||||||
Route::put("config$", [ConfigController::class, "update"])->name("system.updateConfig");
|
Route::put("config$", [ConfigController::class, "update"])->name("system.updateConfig");
|
||||||
Route::delete("config/batch", [ConfigController::class, "batchDelete"])->name("system.batchDeleteConfig");
|
Route::delete("config/batch", [ConfigController::class, "batchDelete"])->name("system.batchDeleteConfig");
|
||||||
Route::put("config/sync", [ConfigController::class, "sync"])->name("system.syncConfig");
|
Route::put("config/sync", [ConfigController::class, "sync"])->name("system.syncConfig");
|
||||||
|
Route::put("config/data", [ConfigController::class, "updateData"])->name("system.updateConfigData");
|
||||||
Route::put("config/status", [ConfigController::class, "updateStatus"])->name("system.updateConfigStatus");
|
Route::put("config/status", [ConfigController::class, "updateStatus"])->name("system.updateConfigStatus");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -115,3 +115,13 @@ export async function infoConfigs() {
|
|||||||
}
|
}
|
||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 修改配置数据
|
||||||
|
*/
|
||||||
|
export async function updateConfigData(data: any) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>('/system/config/data', data);
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@
|
|||||||
<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 {infoConfigs, listConfigs, syncConfigs} from '@/api/system/config';
|
import {infoConfigs, listConfigs, syncConfigs, updateConfigData} 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';
|
||||||
@ -150,6 +150,10 @@ const configFormListRef = ref(null);
|
|||||||
const saveForm = () => {
|
const saveForm = () => {
|
||||||
const allValues = configFormListRef.value?.getFormData();
|
const allValues = configFormListRef.value?.getFormData();
|
||||||
console.log('所有组件数据:', allValues);
|
console.log('所有组件数据:', allValues);
|
||||||
|
updateConfigData(allValues).then(()=>{
|
||||||
|
EleMessage.success("保存成功");
|
||||||
|
reload();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const groupItems = ref([]);
|
const groupItems = ref([]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user