From 662c8f7a47b164bb35c8c3e2f4760a9ccaab783a Mon Sep 17 00:00:00 2001
From: chenminjie <943130926@qq.com>
Date: Mon, 2 Dec 2024 19:01:59 +0800
Subject: [PATCH 1/6] feat: integrate layout footer height calculation in page
component
---
packages/effects/common-ui/src/components/page/page.vue | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/packages/effects/common-ui/src/components/page/page.vue b/packages/effects/common-ui/src/components/page/page.vue
index e8c486eb..05333448 100644
--- a/packages/effects/common-ui/src/components/page/page.vue
+++ b/packages/effects/common-ui/src/components/page/page.vue
@@ -1,6 +1,8 @@
diff --git a/apps/web-antd/src/components/form/components/api-radio-group.vue b/apps/web-antd/src/components/form/components/api-radio-group.vue
index d87e7445..da2ace23 100644
--- a/apps/web-antd/src/components/form/components/api-radio-group.vue
+++ b/apps/web-antd/src/components/form/components/api-radio-group.vue
@@ -123,6 +123,19 @@ watch(
},
{ deep: true },
);
+
+// 监听 value 的变化,确保 mValue 的类型与 options 中的 value 类型一致
+watch(
+ () => props.value,
+ () => {
+ if (props.numberToString && typeof mValue.value === 'number') {
+ mValue.value = `${mValue.value}`;
+ }
+ if (props.numberToString && Array.isArray(mValue.value)) {
+ mValue.value = mValue.value.map((item) => `${item}`);
+ }
+ },
+);
diff --git a/apps/web-antd/src/components/form/components/api-select.vue b/apps/web-antd/src/components/form/components/api-select.vue
index 4e6f1772..ee02d1b7 100644
--- a/apps/web-antd/src/components/form/components/api-select.vue
+++ b/apps/web-antd/src/components/form/components/api-select.vue
@@ -125,6 +125,19 @@ watch(
},
{ deep: true },
);
+
+// 监听 value 的变化,确保 mValue 的类型与 options 中的 value 类型一致
+watch(
+ () => props.value,
+ () => {
+ if (props.numberToString && typeof mValue.value === 'number') {
+ mValue.value = `${mValue.value}`;
+ }
+ if (props.numberToString && Array.isArray(mValue.value)) {
+ mValue.value = mValue.value.map((item) => `${item}`);
+ }
+ },
+);
From c77fb9c84ac66f65dd6a3cea1e773de410fb7b30 Mon Sep 17 00:00:00 2001
From: chenminjie <943130926@qq.com>
Date: Tue, 3 Dec 2024 18:09:15 +0800
Subject: [PATCH 4/6] fix: update form context to use rules instead of
defaultValue for field validation
---
packages/@core/ui-kit/form-ui/src/use-form-context.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/@core/ui-kit/form-ui/src/use-form-context.ts b/packages/@core/ui-kit/form-ui/src/use-form-context.ts
index 7bce3f2e..c6ee5412 100644
--- a/packages/@core/ui-kit/form-ui/src/use-form-context.ts
+++ b/packages/@core/ui-kit/form-ui/src/use-form-context.ts
@@ -43,7 +43,7 @@ export function useFormInitial(
if (Reflect.has(item, 'defaultValue')) {
set(initialValues, item.fieldName, item.defaultValue);
} else if (item.rules && !isString(item.rules)) {
- set(zodObject, item.fieldName, item.defaultValue);
+ set(zodObject, item.fieldName, item.rules);
}
});
From 4fbed026d15853eabcda0f75bf9157df7e66ab97 Mon Sep 17 00:00:00 2001
From: chenminjie <943130926@qq.com>
Date: Tue, 3 Dec 2024 19:06:53 +0800
Subject: [PATCH 5/6] feat: add disabled state to Popconfirm in action-buttons
component
---
apps/web-antd/src/components/action-buttons/action-buttons.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/apps/web-antd/src/components/action-buttons/action-buttons.vue b/apps/web-antd/src/components/action-buttons/action-buttons.vue
index 64b83318..c338cab2 100644
--- a/apps/web-antd/src/components/action-buttons/action-buttons.vue
+++ b/apps/web-antd/src/components/action-buttons/action-buttons.vue
@@ -130,6 +130,7 @@ const handleMenuClick = (e: any) => {
From f88e12fa882b3dc5d8ae932260d4477102914a60 Mon Sep 17 00:00:00 2001
From: chenminjie <943130926@qq.com>
Date: Tue, 3 Dec 2024 19:08:22 +0800
Subject: [PATCH 6/6] feat: implement file configuration management API and UI
components
---
.../src/api/infra/file-config/index.ts | 63 ++++
.../file-config/components/edit-form.vue | 64 ++++
.../infra/file-config/file-config.data.ts | 276 ++++++++++++++++++
.../src/views/infra/file-config/index.vue | 225 ++++++++++++++
4 files changed, 628 insertions(+)
create mode 100644 apps/web-antd/src/api/infra/file-config/index.ts
create mode 100644 apps/web-antd/src/views/infra/file-config/components/edit-form.vue
create mode 100644 apps/web-antd/src/views/infra/file-config/file-config.data.ts
create mode 100644 apps/web-antd/src/views/infra/file-config/index.vue
diff --git a/apps/web-antd/src/api/infra/file-config/index.ts b/apps/web-antd/src/api/infra/file-config/index.ts
new file mode 100644
index 00000000..5ebb1103
--- /dev/null
+++ b/apps/web-antd/src/api/infra/file-config/index.ts
@@ -0,0 +1,63 @@
+import { type PageParam, requestClient } from '#/api/request';
+
+export namespace FileConfigApi {
+ export interface FileClientConfig {
+ basePath: string;
+ host?: string;
+ port?: number;
+ username?: string;
+ password?: string;
+ mode?: string;
+ endpoint?: string;
+ bucket?: string;
+ accessKey?: string;
+ accessSecret?: string;
+ domain: string;
+ }
+
+ export interface FileConfigVO {
+ id: number;
+ name: string;
+ storage?: number;
+ master: boolean;
+ visible: boolean;
+ config: FileClientConfig;
+ remark: string;
+ createTime: Date;
+ }
+}
+
+// 查询文件配置列表
+export function getFileConfigPage(params: PageParam) {
+ return requestClient.get('/infra/file-config/page', { params });
+}
+
+// 查询文件配置详情
+export function getFileConfig(id: number) {
+ return requestClient.get(`/infra/file-config/get?id=${id}`);
+}
+
+// 更新文件配置为主配置
+export function updateFileConfigMaster(id: number) {
+ return requestClient.put(`/infra/file-config/update-master?id=${id}`);
+}
+
+// 新增文件配置
+export function createFileConfig(data: FileConfigApi.FileConfigVO) {
+ return requestClient.post('/infra/file-config/create', data);
+}
+
+// 修改文件配置
+export function updateFileConfig(data: FileConfigApi.FileConfigVO) {
+ return requestClient.put('/infra/file-config/update', data);
+}
+
+// 删除文件配置
+export function deleteFileConfig(id: number) {
+ return requestClient.delete(`/infra/file-config/delete?id=${id}`);
+}
+
+// 测试文件配置
+export function testFileConfig(id: number) {
+ return requestClient.get(`/infra/file-config/test?id=${id}`);
+}
diff --git a/apps/web-antd/src/views/infra/file-config/components/edit-form.vue b/apps/web-antd/src/views/infra/file-config/components/edit-form.vue
new file mode 100644
index 00000000..66846814
--- /dev/null
+++ b/apps/web-antd/src/views/infra/file-config/components/edit-form.vue
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/infra/file-config/file-config.data.ts b/apps/web-antd/src/views/infra/file-config/file-config.data.ts
new file mode 100644
index 00000000..53e98d52
--- /dev/null
+++ b/apps/web-antd/src/views/infra/file-config/file-config.data.ts
@@ -0,0 +1,276 @@
+import type { VxeGridProps } from '#/adapter/vxe-table';
+import type { FileConfigApi } from '#/api/infra/file-config';
+
+import { h } from 'vue';
+
+import { Tag } from 'ant-design-vue';
+
+import { type VbenFormProps, z } from '#/adapter/form';
+import { $t } from '#/locales';
+import { DICT_TYPE } from '#/utils/dict';
+
+/**
+ * 文件配置 表格查询表单配置
+ */
+export const formSchema: VbenFormProps['schema'] = [
+ {
+ fieldName: 'name',
+ label: '配置名称',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入配置名称',
+ },
+ },
+ {
+ fieldName: 'storage',
+ label: '储存器',
+ component: 'ApiDict',
+ componentProps: {
+ code: DICT_TYPE.INFRA_FILE_STORAGE,
+ class: 'w-full',
+ placeholder: '请选择储存器',
+ },
+ },
+ {
+ fieldName: 'createTime',
+ label: '创建时间',
+ component: 'DatePicker',
+ },
+];
+
+/**
+ * 文件配置 表格配置
+ */
+export const tableColumns: VxeGridProps['columns'] =
+ [
+ {
+ fixed: 'left',
+ type: 'checkbox',
+ width: 50,
+ },
+ {
+ fixed: 'left',
+ type: 'seq',
+ width: 50,
+ },
+ { field: 'name', title: '配置名称' },
+ {
+ field: 'storage',
+ title: '储存器',
+ cellRender: {
+ name: 'CellDict',
+ props: { type: DICT_TYPE.INFRA_FILE_STORAGE },
+ },
+ },
+ { field: 'remark', title: '备注' },
+ {
+ field: 'master',
+ title: '主配置',
+ slots: {
+ default: ({ row }) => {
+ return h(
+ Tag,
+ {
+ color: row.master ? 'success' : 'default',
+ },
+ { default: () => (row.master ? '是' : '否') },
+ );
+ },
+ },
+ },
+ { field: 'createTime', title: '创建时间', formatter: 'formatDateTime' },
+ {
+ field: 'action',
+ fixed: 'right',
+ width: '180px',
+ slots: { default: 'action' },
+ title: $t('page.action.action'),
+ },
+ ];
+
+/**
+ * 文件配置 编辑表单配置
+ */
+export const editFormSchema: VbenFormProps['schema'] = [
+ {
+ component: 'Input',
+ fieldName: 'id',
+ label: 'id',
+ dependencies: {
+ triggerFields: [''],
+ show: () => false,
+ },
+ },
+ {
+ fieldName: 'name',
+ label: '配置名称',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入配置名称',
+ },
+ rules: z.string().min(1, '请输入配置名称'),
+ },
+ {
+ fieldName: 'remark',
+ label: '备注',
+ component: 'Input',
+ },
+ {
+ fieldName: 'storage',
+ label: '储存器',
+ component: 'ApiDict',
+ componentProps: {
+ code: DICT_TYPE.INFRA_FILE_STORAGE,
+ class: 'w-full',
+ placeholder: '请选择储存器',
+ numberToString: true,
+ },
+ rules: z.string().min(1, '请选择储存器').or(z.number()),
+ defaultValue: '1',
+ },
+ {
+ fieldName: 'config.basePath',
+ label: '基础路径',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入基础路径',
+ },
+ rules: z.string().min(1, '请输入基础路径'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => {
+ return [10, 11, 12].includes(values.storage);
+ },
+ },
+ },
+ {
+ fieldName: 'config.host',
+ label: '主机地址',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入主机地址',
+ },
+ rules: z.string().min(1, '请输入主机地址'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => [11, 12].includes(values.storage),
+ },
+ },
+ {
+ fieldName: 'config.port',
+ label: '主机端口',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入主机端口',
+ },
+ rules: z.string().min(1, '请输入主机端口'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => [11, 12].includes(values.storage),
+ },
+ },
+ {
+ fieldName: 'config.username',
+ label: '用户名',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入用户名',
+ },
+ rules: z.string().min(1, '请输入用户名'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => [11, 12].includes(values.storage),
+ },
+ },
+ {
+ fieldName: 'config.password',
+ label: '密码',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入密码',
+ },
+ rules: z.string().min(1, '请输入密码'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => [11, 12].includes(values.storage),
+ },
+ },
+ {
+ fieldName: 'config.mode',
+ label: '连接模式',
+ component: 'RadioGroup',
+ componentProps: {
+ options: [
+ { label: '主动模式', value: 'active' },
+ { label: '被动模式', value: 'passive' },
+ ],
+ class: 'w-full',
+ placeholder: '请选择连接模式',
+ },
+ rules: z.string().min(1, '请选择连接模式'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => values.storage === 11,
+ },
+ },
+ {
+ fieldName: 'config.endpoint',
+ label: '端点/节点地址',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入端点/节点地址',
+ },
+ rules: z.string().min(1, '请输入端点/节点地址'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => values.storage === 20,
+ },
+ },
+ {
+ fieldName: 'config.bucket',
+ label: '桶名称',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入桶名称',
+ },
+ rules: z.string().min(1, '请输入桶名称'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => values.storage === 20,
+ },
+ },
+ {
+ fieldName: 'config.accessKey',
+ label: 'accessKey',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入访问密钥',
+ },
+ rules: z.string().min(1, '请输入访问密钥'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => values.storage === 20,
+ },
+ },
+ {
+ fieldName: 'config.accessSecret',
+ label: 'accessSecret',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入访问密钥',
+ },
+ rules: z.string().min(1, '请输入访问密钥'),
+ dependencies: {
+ triggerFields: ['storage'],
+ if: (values: Record) => values.storage === 20,
+ },
+ },
+ {
+ fieldName: 'config.domain',
+ label: '自定义域名',
+ component: 'Input',
+ componentProps: {
+ placeholder: '请输入自定义域名',
+ },
+ },
+];
diff --git a/apps/web-antd/src/views/infra/file-config/index.vue b/apps/web-antd/src/views/infra/file-config/index.vue
new file mode 100644
index 00000000..cb508cc0
--- /dev/null
+++ b/apps/web-antd/src/views/infra/file-config/index.vue
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+