--修改数据优先时,没有表结构配置
This commit is contained in:
@ -643,7 +643,10 @@
|
|||||||
|
|
||||||
const handlerEnableAndDisableButtonConfig = ()=>{
|
const handlerEnableAndDisableButtonConfig = ()=>{
|
||||||
let hasValid = false;
|
let hasValid = false;
|
||||||
let fields = generatorConfig?.tableStructureConfigs[0]?.tableFieldConfigs;
|
|
||||||
|
if(generatorConfig.tableStructureConfigs!=undefined){
|
||||||
|
let structure = generatorConfig.tableStructureConfigs;
|
||||||
|
let fields = structure!=undefined && structure.length > 0? structure[0].tableFieldConfigs:undefined;
|
||||||
if(fields!=undefined){
|
if(fields!=undefined){
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
if(field?.fieldName=='valid'){
|
if(field?.fieldName=='valid'){
|
||||||
@ -652,17 +655,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}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){
|
if(hasValid){
|
||||||
let hasBtn = false;
|
let hasBtn = false;
|
||||||
for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) {
|
for (let i = 0; i < buttonConfigs.length; i++) {
|
||||||
let btn = generatorConfig.listConfig.buttonConfigs[i];
|
let btn = buttonConfigs[i];
|
||||||
if(btn.code=='enable' || btn.code=='disable'){
|
if(btn.code=='enable' || btn.code=='disable'){
|
||||||
hasBtn = true;
|
hasBtn = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!hasBtn){
|
if(!hasBtn){
|
||||||
generatorConfig.listConfig.buttonConfigs.splice(2,0,{
|
buttonConfigs.splice(2,0,{
|
||||||
isUse: true,
|
isUse: true,
|
||||||
name: t('启用'),
|
name: t('启用'),
|
||||||
code: 'enable',
|
code: 'enable',
|
||||||
@ -682,15 +699,15 @@
|
|||||||
let dIndex = -1;
|
let dIndex = -1;
|
||||||
do {
|
do {
|
||||||
dIndex = -1;
|
dIndex = -1;
|
||||||
for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) {
|
for (let i = 0; i < buttonConfigs.length; i++) {
|
||||||
let btn = generatorConfig.listConfig.buttonConfigs[i];
|
let btn = buttonConfigs[i];
|
||||||
if(btn.code=='enable' || btn.code=='disable'){
|
if(btn.code=='enable' || btn.code=='disable'){
|
||||||
dIndex = i;
|
dIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dIndex!=-1){
|
if(dIndex!=-1){
|
||||||
generatorConfig.listConfig.buttonConfigs.splice(dIndex,1);
|
buttonConfigs.splice(dIndex,1);
|
||||||
}
|
}
|
||||||
} while (dIndex!=-1);
|
} while (dIndex!=-1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user