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