From dc4881e24a49642ca100ccc565d74199afd26c25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A6=8F=E8=B4=A2?= <1471584931@qq.com> Date: Wed, 22 Oct 2025 10:23:18 +0800 Subject: [PATCH] =?UTF-8?q?--=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E4=BC=98?= =?UTF-8?q?=E5=85=88=E6=97=B6=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=A1=A8=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateCodeStep/src/ViewDesignStep.vue | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/components/CreateCodeStep/src/ViewDesignStep.vue b/src/components/CreateCodeStep/src/ViewDesignStep.vue index 27e5e55..39c90d6 100644 --- a/src/components/CreateCodeStep/src/ViewDesignStep.vue +++ b/src/components/CreateCodeStep/src/ViewDesignStep.vue @@ -643,26 +643,43 @@ const handlerEnableAndDisableButtonConfig = ()=>{ let hasValid = false; - let fields = generatorConfig?.tableStructureConfigs[0]?.tableFieldConfigs; - if(fields!=undefined){ - for (const field of fields) { - if(field?.fieldName=='valid'){ - hasValid = true; - break; + + if(generatorConfig.tableStructureConfigs!=undefined){ + let structure = generatorConfig.tableStructureConfigs; + let fields = structure!=undefined && structure.length > 0? structure[0].tableFieldConfigs:undefined; + if(fields!=undefined){ + for (const field of fields) { + if(field?.fieldName=='valid'){ + hasValid = true; + break; + } + } + } + }else{ + let fields = generatorConfig.formJson.list; + if(fields!=undefined){ + for (const field of fields) { + if(field?.bindField=='valid'){ + hasValid = true; + break; + } } } } + + let buttonConfigs = generatorConfig?.listConfig?.buttonConfigs; + if(buttonConfigs==undefined) return; if(hasValid){ let hasBtn = false; - for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) { - let btn = generatorConfig.listConfig.buttonConfigs[i]; + for (let i = 0; i < buttonConfigs.length; i++) { + let btn = buttonConfigs[i]; if(btn.code=='enable' || btn.code=='disable'){ hasBtn = true; break; } } if(!hasBtn){ - generatorConfig.listConfig.buttonConfigs.splice(2,0,{ + buttonConfigs.splice(2,0,{ isUse: true, name: t('启用'), code: 'enable', @@ -682,15 +699,15 @@ let dIndex = -1; do { dIndex = -1; - for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) { - let btn = generatorConfig.listConfig.buttonConfigs[i]; + for (let i = 0; i < buttonConfigs.length; i++) { + let btn = buttonConfigs[i]; if(btn.code=='enable' || btn.code=='disable'){ dIndex = i; break; } } if(dIndex!=-1){ - generatorConfig.listConfig.buttonConfigs.splice(dIndex,1); + buttonConfigs.splice(dIndex,1); } } while (dIndex!=-1); }