--添加前端自动生成代码 按钮启用、作废、数据日志
This commit is contained in:
@ -640,6 +640,62 @@
|
||||
const loading = ref(true);
|
||||
const apiConfig = ref({});
|
||||
|
||||
|
||||
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(hasValid){
|
||||
let hasBtn = false;
|
||||
for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) {
|
||||
let btn = generatorConfig.listConfig.buttonConfigs[i];
|
||||
if(btn.code=='enable' || btn.code=='disable'){
|
||||
hasBtn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!hasBtn){
|
||||
generatorConfig.listConfig.buttonConfigs.splice(2,0,{
|
||||
isUse: true,
|
||||
name: t('启用'),
|
||||
code: 'enable',
|
||||
icon: 'ant-design:form-outlined',
|
||||
isDefault: true,
|
||||
type: 'primary'
|
||||
},{
|
||||
isUse: true,
|
||||
name: t('作废'),
|
||||
code: 'disable',
|
||||
icon: 'ant-design:stop-outlined',
|
||||
isDefault: true,
|
||||
type: 'dashed'
|
||||
})
|
||||
}
|
||||
}else{
|
||||
let dIndex = -1;
|
||||
do {
|
||||
dIndex = -1;
|
||||
for (let i = 0; i < generatorConfig.listConfig.buttonConfigs.length; i++) {
|
||||
let btn = generatorConfig.listConfig.buttonConfigs[i];
|
||||
if(btn.code=='enable' || btn.code=='disable'){
|
||||
dIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(dIndex!=-1){
|
||||
generatorConfig.listConfig.buttonConfigs.splice(dIndex,1);
|
||||
}
|
||||
} while (dIndex!=-1);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
//如果已经有按钮设置了 就不再添加默认值
|
||||
if (
|
||||
@ -690,6 +746,13 @@
|
||||
icon: 'ant-design:delete-outlined',
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
isUse: false,
|
||||
name: t('数据日志'),
|
||||
code: 'datalog',
|
||||
icon: 'ant-design:profile-outlined',
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
isUse: false,
|
||||
name: '复制数据',
|
||||
@ -747,6 +810,8 @@
|
||||
isDefault: true,
|
||||
},
|
||||
];
|
||||
|
||||
handlerEnableAndDisableButtonConfig();
|
||||
}
|
||||
});
|
||||
|
||||
@ -947,6 +1012,8 @@
|
||||
generatorConfig.listConfig.columnConfigs.unshift(...columnConfigs);
|
||||
generatorConfig.listConfig.queryConfigs.unshift(...queryConfigs);
|
||||
}
|
||||
|
||||
handlerEnableAndDisableButtonConfig();
|
||||
};
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user