diff --git a/apps/web-antd/package.json b/apps/web-antd/package.json index a3f54003..6a31099c 100644 --- a/apps/web-antd/package.json +++ b/apps/web-antd/package.json @@ -47,6 +47,7 @@ "@vueuse/core": "catalog:", "ant-design-vue": "catalog:", "dayjs": "catalog:", + "exceljs": "^4.4.0", "jszip": "^3.10.1", "markdown-it": "^15.0.0", "pinia": "catalog:", diff --git a/apps/web-antd/src/adapter/form.ts b/apps/web-antd/src/adapter/form.ts index 67aae156..fa11ce82 100644 --- a/apps/web-antd/src/adapter/form.ts +++ b/apps/web-antd/src/adapter/form.ts @@ -21,6 +21,9 @@ async function initSetupVbenForm() { Radio: 'checked', Switch: 'checked', Upload: 'fileList', + // 自研上传组件用 v-model(modelValue),不跟 antd 的 value 走 + UploadImage: 'modelValue', + UploadDoc: 'modelValue', }, }, rules: { diff --git a/apps/web-antd/src/components/crud/grid-options.ts b/apps/web-antd/src/components/crud/grid-options.ts index b0ac9cf7..c9e49015 100644 --- a/apps/web-antd/src/components/crud/grid-options.ts +++ b/apps/web-antd/src/components/crud/grid-options.ts @@ -19,7 +19,9 @@ interface CreateGridOptions { * 列表页表格配置的公共部分。 * 各模块的 table.ts 只写自己的列与请求,其余(勾选、工具栏、高度、代理)统一在这里。 */ -export function createGridOptions(options: CreateGridOptions): VxeGridProps { +export function createGridOptions( + options: CreateGridOptions, +): VxeGridProps { const { columns, extra = {}, @@ -56,12 +58,15 @@ export function createGridOptions(options: CreateGridOptions): VxeGridProps showOverflow: false, toolbarConfig: { custom: { icon: 'vxe-icon-menu' }, + // 必须显式打开:适配器在找不到 #toolbar-actions 时会先写成 enabled=false,深合并后会把整栏关掉 + enabled: true, export: false, print: false, refresh: true, - // @ts-ignore 适配器类型未声明 search + // @ts-expect-error 适配器类型未声明 search search: true, - slots: { buttons: 'toolbar-buttons' }, + // Vben 5.7 只认 toolbar-actions,页面插槽必须同名 + slots: { buttons: 'toolbar-actions' }, zoom: true, }, }; diff --git a/apps/web-antd/src/components/crud/index.ts b/apps/web-antd/src/components/crud/index.ts index 983e3314..906f7b17 100644 --- a/apps/web-antd/src/components/crud/index.ts +++ b/apps/web-antd/src/components/crud/index.ts @@ -11,10 +11,19 @@ export function toImageList(value?: null | string): string[] { return value ? [value] : []; } -/** 取图片数组第一项,空数组转空串 */ -export function firstImage(value?: null | string | string[]): string { +/** 取图片数组第一项,空数组转空串;对象则取 url */ +export function firstImage( + value?: null | Record | string | string[], +): string { if (Array.isArray(value)) { - return value[0] ?? ''; + const first = value[0]; + if (first && typeof first === 'object') { + return String(first.url || first.uid || ''); + } + return (first as string) ?? ''; + } + if (value && typeof value === 'object') { + return String(value.url || ''); } return value ?? ''; } diff --git a/apps/web-antd/src/components/crud/simple-name-page.vue b/apps/web-antd/src/components/crud/simple-name-page.vue index 4ee4112b..c83e13e8 100644 --- a/apps/web-antd/src/components/crud/simple-name-page.vue +++ b/apps/web-antd/src/components/crud/simple-name-page.vue @@ -17,10 +17,10 @@ import { useCrudTable } from './use-crud-table'; */ const props = defineProps<{ crudApi: CrudApi; - /** 名称列标题,如「分类名称」 */ - nameLabel: string; /** 页面与弹窗标题,如「工厂分类」 */ moduleTitle: string; + /** 名称列标题,如「分类名称」 */ + nameLabel: string; }>(); const gridOptions = createGridOptions({ @@ -56,7 +56,7 @@ const { FormModal, Grid, hasSelection, removeRows, showModal, toggleStatus } = :name-label="nameLabel" /> -