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