mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-26 12:48:48 +08:00
parent
4f9cdc5634
commit
58b30aae9a
@ -10,6 +10,7 @@
|
|||||||
<slot name="formHeader"></slot>
|
<slot name="formHeader"></slot>
|
||||||
<template v-for="schema in getSchema" :key="schema.field">
|
<template v-for="schema in getSchema" :key="schema.field">
|
||||||
<FormItem
|
<FormItem
|
||||||
|
:isAdvanced="fieldsIsAdvancedMap[schema.field]"
|
||||||
:tableAction="tableAction"
|
:tableAction="tableAction"
|
||||||
:formActionType="formActionType"
|
:formActionType="formActionType"
|
||||||
:schema="schema"
|
:schema="schema"
|
||||||
@ -141,7 +142,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { handleToggleAdvanced } = useAdvanced({
|
const { handleToggleAdvanced, fieldsIsAdvancedMap } = useAdvanced({
|
||||||
advanceState,
|
advanceState,
|
||||||
emit,
|
emit,
|
||||||
getProps,
|
getProps,
|
||||||
@ -299,6 +300,7 @@
|
|||||||
getFormActionBindProps: computed(
|
getFormActionBindProps: computed(
|
||||||
(): Recordable => ({ ...getProps.value, ...advanceState }),
|
(): Recordable => ({ ...getProps.value, ...advanceState }),
|
||||||
),
|
),
|
||||||
|
fieldsIsAdvancedMap,
|
||||||
...formActionType,
|
...formActionType,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -44,6 +44,9 @@
|
|||||||
formActionType: {
|
formActionType: {
|
||||||
type: Object as PropType<FormActionType>,
|
type: Object as PropType<FormActionType>,
|
||||||
},
|
},
|
||||||
|
isAdvanced: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup(props, { slots }) {
|
setup(props, { slots }) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -103,8 +106,8 @@
|
|||||||
const { show, ifShow } = props.schema;
|
const { show, ifShow } = props.schema;
|
||||||
const { showAdvancedButton } = props.formProps;
|
const { showAdvancedButton } = props.formProps;
|
||||||
const itemIsAdvanced = showAdvancedButton
|
const itemIsAdvanced = showAdvancedButton
|
||||||
? isBoolean(props.schema.isAdvanced)
|
? isBoolean(props.isAdvanced)
|
||||||
? props.schema.isAdvanced
|
? props.isAdvanced
|
||||||
: true
|
: true
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { ColEx } from '../types';
|
import type { ColEx } from '../types';
|
||||||
import type { AdvanceState } from '../types/hooks';
|
import type { AdvanceState } from '../types/hooks';
|
||||||
import { ComputedRef, getCurrentInstance, Ref } from 'vue';
|
import { ComputedRef, getCurrentInstance, Ref, shallowReactive } from 'vue';
|
||||||
import type { FormProps, FormSchema } from '../types/form';
|
import type { FormProps, FormSchema } from '../types/form';
|
||||||
import { computed, unref, watch } from 'vue';
|
import { computed, unref, watch } from 'vue';
|
||||||
import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
|
import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
|
||||||
@ -113,6 +113,8 @@ export default function ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fieldsIsAdvancedMap = shallowReactive({});
|
||||||
|
|
||||||
function updateAdvanced() {
|
function updateAdvanced() {
|
||||||
let itemColSum = 0;
|
let itemColSum = 0;
|
||||||
let realItemColSum = 0;
|
let realItemColSum = 0;
|
||||||
@ -148,7 +150,7 @@ export default function ({
|
|||||||
if (isAdvanced) {
|
if (isAdvanced) {
|
||||||
realItemColSum = itemColSum;
|
realItemColSum = itemColSum;
|
||||||
}
|
}
|
||||||
schema.isAdvanced = isAdvanced;
|
fieldsIsAdvancedMap[schema.field] = isAdvanced;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,5 +168,5 @@ export default function ({
|
|||||||
advanceState.isAdvanced = !advanceState.isAdvanced;
|
advanceState.isAdvanced = !advanceState.isAdvanced;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { handleToggleAdvanced };
|
return { handleToggleAdvanced, fieldsIsAdvancedMap };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user