up.
This commit is contained in:
parent
bdff9fc088
commit
d79d914ed9
@ -14,7 +14,7 @@ class ConfigController extends BaseController
|
|||||||
{
|
{
|
||||||
public function list(): Json
|
public function list(): Json
|
||||||
{
|
{
|
||||||
$model = SysConfig::with([])
|
$model = SysConfig::with([])->order(['sort'=>'asc'])
|
||||||
->withSearch(['group'], [
|
->withSearch(['group'], [
|
||||||
'group'=> $this->request->get('group/s','')
|
'group'=> $this->request->get('group/s','')
|
||||||
]);
|
]);
|
||||||
@ -100,10 +100,20 @@ class ConfigController extends BaseController
|
|||||||
{
|
{
|
||||||
$id = $this->request->put('id');
|
$id = $this->request->put('id');
|
||||||
$status = $this->request->put('status');
|
$status = $this->request->put('status');
|
||||||
$user = SysConfig::findOrFail($id);
|
$cfg = SysConfig::findOrFail($id);
|
||||||
$user->save(['status'=>$status]);
|
$cfg->save(['status'=>$status]);
|
||||||
return $this->writeSuccess('修改成功');
|
return $this->writeSuccess('修改成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateSort()
|
||||||
|
{
|
||||||
|
$id = $this->request->put('id');
|
||||||
|
$sort = $this->request->put('sort');
|
||||||
|
$cfg = SysConfig::findOrFail($id);
|
||||||
|
$cfg->save(['sort'=>$sort]);
|
||||||
|
return $this->writeSuccess('修改成功');
|
||||||
|
}
|
||||||
|
|
||||||
public function batchDelete()
|
public function batchDelete()
|
||||||
{
|
{
|
||||||
$data = $this->request->delete();
|
$data = $this->request->delete();
|
||||||
|
|||||||
@ -78,6 +78,8 @@ Route::group("adminapi", function () {
|
|||||||
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/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");
|
||||||
|
Route::put("config/sort", [ConfigController::class, "updateSort"])->name("system.updateConfigSort");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 用户管理
|
* 用户管理
|
||||||
|
|||||||
@ -65,6 +65,19 @@ export async function updateConfigStatus(id: number, status: number) {
|
|||||||
return Promise.reject(new Error(res.data.message));
|
return Promise.reject(new Error(res.data.message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改配置状态
|
||||||
|
*/
|
||||||
|
export async function updateConfigSort(id: number, sort: number) {
|
||||||
|
const res = await request.put<ApiResult<unknown>>('/system/config/sort', {
|
||||||
|
id,
|
||||||
|
sort
|
||||||
|
});
|
||||||
|
if (res.data.code === 0) {
|
||||||
|
return res.data.message;
|
||||||
|
}
|
||||||
|
return Promise.reject(new Error(res.data.message));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除配置
|
* 批量删除配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -71,7 +71,7 @@
|
|||||||
<span :title="row.type">{{ getItemLabel(row.type) }}</span>
|
<span :title="row.type">{{ getItemLabel(row.type) }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #sort="{ row }">
|
<template #sort="{ row }">
|
||||||
<el-input-number :controls="false" v-model="row.sort" :min="1" :max="9999" style="width: 100%;"></el-input-number>
|
<el-input-number :controls="false" v-model="row.sort" @update:modelValue="(sort)=>updateSort(row.id, row.sort)" :min="1" :max="9999" style="width: 100%;"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</ele-pro-table>
|
</ele-pro-table>
|
||||||
</ele-card>
|
</ele-card>
|
||||||
@ -102,7 +102,8 @@
|
|||||||
import {
|
import {
|
||||||
listConfigs,
|
listConfigs,
|
||||||
updateConfigStatus,
|
updateConfigStatus,
|
||||||
removeConfigs
|
removeConfigs,
|
||||||
|
updateConfigSort
|
||||||
} from '@/api/system/config';
|
} from '@/api/system/config';
|
||||||
import { getSysConfig } from '@/utils/sys-config';
|
import { getSysConfig } from '@/utils/sys-config';
|
||||||
import { ItemType, getItemLabel } from '@/enum/config-item-type.ts';
|
import { ItemType, getItemLabel } from '@/enum/config-item-type.ts';
|
||||||
@ -243,6 +244,11 @@
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const updateSort = (id, sort) => {
|
||||||
|
updateConfigSort(id, sort).then(()=>{
|
||||||
|
EleMessage.success("更新成功");
|
||||||
|
});
|
||||||
|
}
|
||||||
/** 修改配置状态 */
|
/** 修改配置状态 */
|
||||||
const editStatus = (checked: boolean, row: Config) => {
|
const editStatus = (checked: boolean, row: Config) => {
|
||||||
const status = checked ? 1 : 0;
|
const status = checked ? 1 : 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user