refactor: 适配系统参数 API 新的使用方式

This commit is contained in:
2024-05-28 23:12:24 +08:00
parent 45cbabf545
commit 1909b6e907
4 changed files with 8 additions and 6 deletions

View File

@@ -263,6 +263,7 @@ export interface StoragePageQuery extends StorageQuery, PageQuery {
/** 系统参数类型 */ /** 系统参数类型 */
export interface OptionResp { export interface OptionResp {
id: string
name: string name: string
code: string code: string
value: string value: string
@@ -270,7 +271,8 @@ export interface OptionResp {
} }
export interface OptionQuery { export interface OptionQuery {
code: Array<string> code?: Array<string>
category?: string
} }
/** 基础配置类型 */ /** 基础配置类型 */

View File

@@ -59,7 +59,7 @@ const storeSetup = () => {
// 初始化系统配置 // 初始化系统配置
const initSiteConfig = () => { const initSiteConfig = () => {
listOptionDict({ listOptionDict({
code: ['SITE_FAVICON', 'SITE_LOGO', 'SITE_TITLE', 'SITE_COPYRIGHT'] category: 'SITE'
}).then((res) => { }).then((res) => {
const resMap = new Map() const resMap = new Map()
res.data.forEach((item) => { res.data.forEach((item) => {

View File

@@ -125,7 +125,7 @@ const handleCancel = () => {
} }
const queryForm = { const queryForm = {
code: Object.keys(mailConfig.value) category: 'MAIL'
} }
// 查询列表数据 // 查询列表数据
const getDataList = async () => { const getDataList = async () => {
@@ -143,7 +143,7 @@ const handleSave = async () => {
if (isInvalid) return false if (isInvalid) return false
await updateOption( await updateOption(
Object.entries(form).map(([key, value]) => { Object.entries(form).map(([key, value]) => {
return { code: key, value } return { id: mailConfig.value[key].id, code: key, value }
}) })
) )
await getDataList() await getDataList()

View File

@@ -160,7 +160,7 @@ const handleCancel = () => {
} }
const queryForm = { const queryForm = {
code: Object.keys(securityConfig.value) category: 'PASSWORD'
} }
// 查询列表数据 // 查询列表数据
const getDataList = async () => { const getDataList = async () => {
@@ -178,7 +178,7 @@ const handleSave = async () => {
if (isInvalid) return false if (isInvalid) return false
await updateOption( await updateOption(
Object.entries(form).map(([key, value]) => { Object.entries(form).map(([key, value]) => {
return { code: key, value } return { id: securityConfig.value[key].id, code: key, value }
}) })
) )
await getDataList() await getDataList()