From c1ffed6e2ded21050ab59fea59b72e9cd9242b91 Mon Sep 17 00:00:00 2001 From: zhouz <> Date: Wed, 15 Jul 2026 17:43:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E5=88=99=E8=A1=A8=E5=8D=95=E4=BA=A4=E4=BA=92=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=88=86=E6=AE=B5=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Textarea组件名修正为 Input + type:textarea - 新增 SegmentEditor 交互式分段配置组件(选择类型、配置参数、拖拽排序) - 修复搜索表单 query 回调缺失 formValues 参数 - 移除不支持的 help schema 属性 --- .../base/codegen/components/SegmentEditor.vue | 303 ++++++++++++++++++ .../src/views/base/codegen/data.ts | 34 +- .../src/views/base/codegen/index.vue | 18 +- .../src/views/base/codegen/modules/form.vue | 44 ++- 4 files changed, 355 insertions(+), 44 deletions(-) create mode 100644 nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/components/SegmentEditor.vue diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/components/SegmentEditor.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/components/SegmentEditor.vue new file mode 100644 index 00000000..0ccd0a6a --- /dev/null +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/components/SegmentEditor.vue @@ -0,0 +1,303 @@ + + + + + diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/data.ts b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/data.ts index c79735dd..3dfd9382 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/data.ts +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/data.ts @@ -23,7 +23,7 @@ const STATUS_OPTIONS = [ { label: '禁用', value: 1 }, ]; -/** 新增/修改的表单 */ +/** 新增/修改的表单(不含 segments,segments 使用自定义组件) */ export function useFormSchema(): VbenFormSchema[] { return [ { @@ -52,18 +52,6 @@ export function useFormSchema(): VbenFormSchema[] { placeholder: '请输入规则编码(唯一标识)', }, }, - { - fieldName: 'segments', - label: '分段配置', - rules: 'required', - component: 'Textarea', - componentProps: { - placeholder: - 'JSON数组格式,例如:\n[{"type":"PREFIX","value":"ORD"},{"type":"DATE","format":"yyyyMMdd"},{"type":"SEQUENCE","resetBy":"DAY","startAt":1,"paddingLen":4,"paddingChar":"0","maxValue":9999}]', - rows: 6, - }, - help: 'JSON数组格式。type: PREFIX/DATE/SEQUENCE', - }, { fieldName: 'separator', label: '分隔符', @@ -115,8 +103,9 @@ export function useFormSchema(): VbenFormSchema[] { { fieldName: 'remark', label: '备注', - component: 'Textarea', + component: 'Input', componentProps: { + type: 'textarea', placeholder: '请输入备注', rows: 3, }, @@ -184,10 +173,23 @@ export function useGridColumns(): VxeTableGridOptions[ { field: 'segmentConfig', title: '分段配置', - minWidth: 200, + minWidth: 240, formatter: ({ cellValue }: { cellValue: BaseCodeRuleApi.SegmentConfig[] }) => { if (!cellValue || cellValue.length === 0) return '-'; - return cellValue.map((s) => s.type).join(' + '); + return cellValue + .map((s) => { + switch (s.type) { + case 'PREFIX': + return `前缀:${s.value || ''}`; + case 'DATE': + return `日期(${s.format || 'yyyyMMdd'})`; + case 'SEQUENCE': + return `序号(${s.resetBy || 'DAY'}/${s.paddingLen || 4}位)`; + default: + return s.type; + } + }) + .join(' + '); }, }, { diff --git a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/index.vue b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/index.vue index 8a9b5679..f9e0740f 100644 --- a/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/index.vue +++ b/nl-ui/nl-ui-admin-vben/yudao-ui-admin-vben/apps/web-antdv-next/src/views/base/codegen/index.vue @@ -59,7 +59,6 @@ async function handleDeleteBatch() { duration: 0, }); try { - // 逐个删除 for (const id of checkedIds.value) { await deleteCodeRule(id); } @@ -81,6 +80,9 @@ function handleRowCheckboxChange({ } const [Grid, gridApi] = useVbenVxeGrid({ + formOptions: { + schema: useGridFormSchema(), + }, gridOptions: { columns: useGridColumns(), height: 'auto', @@ -89,13 +91,12 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, proxyConfig: { ajax: { - query: async ({ page }) => { - const params = { + query: async ({ page }, formValues) => { + return await getCodeRulePage({ pageNo: page.currentPage, pageSize: page.pageSize, - ...formData.value, - }; - return await getCodeRulePage(params); + ...formValues, + }); }, }, }, @@ -112,12 +113,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ checkboxAll: handleRowCheckboxChange, checkboxChange: handleRowCheckboxChange, }, - formOptions: { - schema: useGridFormSchema(), - }, }); - -const formData = ref>({});