mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-04-03 08:13:24 +08:00
feat(oss-config): 添加YesNo常量并优化OSS配置表单
在constants/core.ts中添加YesNo常量 移除oss-config表单中多余的formItemClass属性 将TableSwitch替换为ApiSwitch并实现状态切换功能
This commit is contained in:
@@ -193,7 +193,6 @@ export const drawerSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
defaultValue: '0',
|
defaultValue: '0',
|
||||||
fieldName: 'accessPolicy',
|
fieldName: 'accessPolicy',
|
||||||
formItemClass: 'col-span-6 lg:col-span-3',
|
|
||||||
label: '权限桶类型',
|
label: '权限桶类型',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -205,7 +204,6 @@ export const drawerSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
defaultValue: 'N',
|
defaultValue: 'N',
|
||||||
fieldName: 'isHttps',
|
fieldName: 'isHttps',
|
||||||
formItemClass: 'col-span-6 lg:col-span-3',
|
|
||||||
label: '是否https',
|
label: '是否https',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { OssConfig } from '#/api/system/oss-config/model';
|
|||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
import { useAccess } from '@vben/access';
|
||||||
import { Page, useVbenDrawer } from '@vben/common-ui';
|
import { Page, useVbenDrawer } from '@vben/common-ui';
|
||||||
|
import { EnableStatus } from '@vben/constants';
|
||||||
|
|
||||||
import { Modal, Popconfirm, Space } from 'antdv-next';
|
import { Modal, Popconfirm, Space } from 'antdv-next';
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ import {
|
|||||||
ossConfigList,
|
ossConfigList,
|
||||||
ossConfigRemove,
|
ossConfigRemove,
|
||||||
} from '#/api/system/oss-config';
|
} from '#/api/system/oss-config';
|
||||||
import { TableSwitch } from '#/components/table';
|
import { ApiSwitch } from '#/components/global';
|
||||||
|
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
import ossConfigDrawer from './oss-config-drawer.vue';
|
import ossConfigDrawer from './oss-config-drawer.vue';
|
||||||
@@ -100,6 +101,13 @@ function handleMultiDelete() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
const { hasAccessByCodes } = useAccess();
|
||||||
|
async function handleChangeStatus(checked: boolean, row: OssConfig) {
|
||||||
|
await ossConfigChangeStatus({
|
||||||
|
ossConfigId: row.ossConfigId,
|
||||||
|
configKey: row.configKey,
|
||||||
|
status: checked ? EnableStatus.Enable : EnableStatus.Disable,
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -126,9 +134,9 @@ const { hasAccessByCodes } = useAccess();
|
|||||||
</Space>
|
</Space>
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ row }">
|
<template #status="{ row }">
|
||||||
<TableSwitch
|
<ApiSwitch
|
||||||
v-model:value="row.status"
|
:value="row.status === EnableStatus.Enable"
|
||||||
:api="() => ossConfigChangeStatus(row)"
|
:api="(checked) => handleChangeStatus(checked, row)"
|
||||||
:disabled="!hasAccessByCodes(['system:ossConfig:edit'])"
|
:disabled="!hasAccessByCodes(['system:ossConfig:edit'])"
|
||||||
checked-text="是"
|
checked-text="是"
|
||||||
un-checked-text="否"
|
un-checked-text="否"
|
||||||
|
|||||||
@@ -59,3 +59,8 @@ export const EnableStatus = {
|
|||||||
Enable: '0',
|
Enable: '0',
|
||||||
Disable: '1',
|
Disable: '1',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const YesNo = {
|
||||||
|
Yes: 'Y',
|
||||||
|
No: 'N',
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user