From b52f7803adc76b221420c18003a20680f6997621 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 9 Sep 2025 09:06:42 +0800 Subject: [PATCH] =?UTF-8?q?reactor=EF=BC=9A=E3=80=90infra=20=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=AE=BE=E6=96=BD=E3=80=91fileConfig=20=E8=BF=9B?= =?UTF-8?q?=E4=B8=80=E6=AD=A5=E7=BB=9F=E4=B8=80=E4=BB=A3=E7=A0=81=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/infra/fileConfig/data.ts | 22 ++-- .../src/views/infra/fileConfig/data.ts | 58 ++------- .../src/views/infra/fileConfig/index.vue | 119 +++++++++++------- .../views/infra/fileConfig/modules/form.vue | 4 +- 4 files changed, 99 insertions(+), 104 deletions(-) diff --git a/apps/web-antd/src/views/infra/fileConfig/data.ts b/apps/web-antd/src/views/infra/fileConfig/data.ts index 6d3395693..6f5e691c7 100644 --- a/apps/web-antd/src/views/infra/fileConfig/data.ts +++ b/apps/web-antd/src/views/infra/fileConfig/data.ts @@ -40,6 +40,14 @@ export function useFormSchema(): VbenFormSchema[] { show: (formValues) => !formValues.id, }, }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + }, + }, // DB / Local / FTP / SFTP { fieldName: 'config.basePath', @@ -236,14 +244,6 @@ export function useFormSchema(): VbenFormSchema[] { show: (formValues) => !!formValues.storage, }, }, - { - fieldName: 'remark', - label: '备注', - component: 'Textarea', - componentProps: { - placeholder: '请输入备注', - }, - }, ]; } @@ -288,14 +288,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'id', title: '编号', + minWidth: 100, }, { field: 'name', title: '配置名', + minWidth: 120, }, { field: 'storage', title: '存储器', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.INFRA_FILE_STORAGE }, @@ -304,10 +307,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'remark', title: '备注', + minWidth: 150, }, { field: 'master', title: '主配置', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, @@ -316,6 +321,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { diff --git a/apps/web-ele/src/views/infra/fileConfig/data.ts b/apps/web-ele/src/views/infra/fileConfig/data.ts index 629a11fb7..6f5e691c7 100644 --- a/apps/web-ele/src/views/infra/fileConfig/data.ts +++ b/apps/web-ele/src/views/infra/fileConfig/data.ts @@ -1,16 +1,11 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; -import type { InfraFileConfigApi } from '#/api/infra/file-config'; - -import { useAccess } from '@vben/access'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; import { getRangePickerDefaultProps } from '#/utils'; -const { hasAccessByCodes } = useAccess(); - /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -261,7 +256,7 @@ export function useGridFormSchema(): VbenFormSchema[] { component: 'Input', componentProps: { placeholder: '请输入配置名', - clearable: true, + allowClear: true, }, }, { @@ -271,7 +266,7 @@ export function useGridFormSchema(): VbenFormSchema[] { componentProps: { options: getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE, 'number'), placeholder: '请选择存储器', - clearable: true, + allowClear: true, }, }, { @@ -280,22 +275,20 @@ export function useGridFormSchema(): VbenFormSchema[] { component: 'RangePicker', componentProps: { ...getRangePickerDefaultProps(), - clearable: true, + allowClear: true, }, }, ]; } /** 列表的字段 */ -export function useGridColumns( - onActionClick: OnActionClickFn, -): VxeTableGridOptions['columns'] { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { type: 'checkbox', width: 40 }, { field: 'id', title: '编号', - width: 100, + minWidth: 100, }, { field: 'name', @@ -305,7 +298,7 @@ export function useGridColumns( { field: 'storage', title: '存储器', - width: 100, + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.INFRA_FILE_STORAGE }, @@ -319,7 +312,7 @@ export function useGridColumns( { field: 'master', title: '主配置', - width: 100, + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.INFRA_BOOLEAN_STRING }, @@ -328,43 +321,14 @@ export function useGridColumns( { field: 'createTime', title: '创建时间', - width: 180, + minWidth: 180, formatter: 'formatDateTime', }, { - field: 'operation', title: '操作', - width: 280, + width: 240, fixed: 'right', - align: 'center', - cellRender: { - attrs: { - nameField: 'name', - nameTitle: '文件配置', - onClick: onActionClick, - }, - name: 'CellOperation', - options: [ - { - code: 'edit', - show: hasAccessByCodes(['infra:file-config:update']), - }, - { - code: 'delete', - show: hasAccessByCodes(['infra:file-config:delete']), - }, - { - code: 'master', - text: '主配置', - disabled: (row: any) => row.master, - show: (_row: any) => hasAccessByCodes(['infra:file-config:update']), - }, - { - code: 'test', - text: '测试', - }, - ], - }, + slots: { default: 'actions' }, }, ]; } diff --git a/apps/web-ele/src/views/infra/fileConfig/index.vue b/apps/web-ele/src/views/infra/fileConfig/index.vue index 6c3b24e26..6e15511f8 100644 --- a/apps/web-ele/src/views/infra/fileConfig/index.vue +++ b/apps/web-ele/src/views/infra/fileConfig/index.vue @@ -1,8 +1,5 @@