Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -489,67 +489,77 @@
|
|||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const apiConfig = ref({});
|
const apiConfig = ref({});
|
||||||
|
|
||||||
const handlerEnableAndDisableButtonConfig = () => {
|
const handlerEnableAndDisableButtonConfig = ()=>{
|
||||||
let hasValid = false;
|
let hasValid = false;
|
||||||
// let fields = generatorConfig?.tableStructureConfigs[0]?.tableFieldConfigs;
|
|
||||||
let a = generatorConfig?.tableStructureConfigs || []
|
if(generatorConfig.tableStructureConfigs!=undefined){
|
||||||
let fields = (a[0] || {}).tableFieldConfigs;
|
let structure = generatorConfig.tableStructureConfigs;
|
||||||
if (fields != undefined) {
|
let fields = structure!=undefined && structure.length > 0? structure[0].tableFieldConfigs:undefined;
|
||||||
|
if(fields!=undefined){
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
if (field?.fieldName == 'valid') {
|
if(field?.fieldName=='valid'){
|
||||||
hasValid = true;
|
hasValid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasValid) {
|
}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;
|
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(
|
buttonConfigs.splice(2,0,{
|
||||||
2,
|
|
||||||
0,
|
|
||||||
{
|
|
||||||
isUse: true,
|
isUse: true,
|
||||||
name: t('启用'),
|
name: t('启用'),
|
||||||
code: 'enable',
|
code: 'enable',
|
||||||
icon: 'ant-design:form-outlined',
|
icon: 'ant-design:form-outlined',
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
type: 'primary'
|
type: 'primary'
|
||||||
},
|
},{
|
||||||
{
|
|
||||||
isUse: true,
|
isUse: true,
|
||||||
name: t('作废'),
|
name: t('作废'),
|
||||||
code: 'disable',
|
code: 'disable',
|
||||||
icon: 'ant-design:stop-outlined',
|
icon: 'ant-design:stop-outlined',
|
||||||
isDefault: true,
|
isDefault: true,
|
||||||
type: 'dashed'
|
type: 'dashed'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
);
|
}else{
|
||||||
}
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
//如果已经有按钮设置了 就不再添加默认值
|
//如果已经有按钮设置了 就不再添加默认值
|
||||||
|
|||||||
Reference in New Issue
Block a user