From 3ada755dcc937ac99bb4765acf107795f810fd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A5=9E=E4=BB=99=E9=83=BD=E6=B2=A1=E7=94=A8?= <615206459@qq.com> Date: Mon, 5 Aug 2024 14:26:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3ai=E7=BC=96=E7=A0=81options?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/helper/hooks/code.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/modules/helper/hooks/code.ts b/src/modules/helper/hooks/code.ts index f500b86..e406f2c 100644 --- a/src/modules/helper/hooks/code.ts +++ b/src/modules/helper/hooks/code.ts @@ -226,7 +226,7 @@ export function useCode() { // 字典 const dict = item.component?.options || column.dict; - if (dict) { + if (!isEmpty(dict)) { options[item.prop] = dict; const str = `$$options.${item.prop}$$`; @@ -326,13 +326,17 @@ export function useCode() { // 筛选 const clFilter = fieldEq .map((field) => { - const item = upsert.items.find((e) => e.prop == field); - - if (item) { - return `\n\n\n`; - } else { + if (isEmpty(options[field])) { return ""; } + + const item = upsert.items.find((e) => e.prop == field); + + if (!item) { + return ""; + } + + return `\n\n\n`; }) .filter(Boolean) .join("\n");