|
|
|
|
@ -21,11 +21,14 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f
|
|
|
|
|
const presets = useDatePresets();
|
|
|
|
|
const [formValues, setFormValues] = useFormStore(state => [state.formValues, state.setFormValues]);
|
|
|
|
|
const [formValuesToSub, setFormValuesToSub] = useFormStore(state => [state.formValuesToSub, state.setFormValuesToSub]);
|
|
|
|
|
const isPermitted = useAuthStore((state) => state.isPermitted)
|
|
|
|
|
const [isPermitted, {travelAgencyName: myAgencyName, travelAgencyId: myAgencyId}] = useAuthStore((state) => [state.isPermitted, state.currentUser])
|
|
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
|
|
|
|
const defaultShowFields = isPermitted(PERM_AGENCY_ALL) ? ['agency'] : [];
|
|
|
|
|
const defaultFieldsProps = isPermitted(PERM_AGENCY_ALL) ? { agency: { col: 24 }, } : {};
|
|
|
|
|
const defaultFieldsComProps = isPermitted(PERM_AGENCY_ALL) ? { agency: { mode: null }, } : {};
|
|
|
|
|
const defaultFieldsComProps = isPermitted(PERM_AGENCY_ALL) ? { agency: { mode: null, allowClear: false }, } : {};
|
|
|
|
|
const defaultInitialValue = isPermitted(PERM_AGENCY_ALL) ? { agency: { key: myAgencyId, value: myAgencyId, label: myAgencyName }} : {};
|
|
|
|
|
|
|
|
|
|
const { sort, hides, shows, fieldProps, fieldComProps } = {
|
|
|
|
|
sort: "",
|
|
|
|
|
// initialValue: '',
|
|
|
|
|
@ -35,7 +38,7 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f
|
|
|
|
|
fieldProps: { ...defaultFieldsProps, ...(props.fieldsConfig?.fieldProps || {}) },
|
|
|
|
|
fieldComProps: { ...defaultFieldsComProps, ...(props.fieldsConfig?.fieldComProps || {}) },
|
|
|
|
|
};
|
|
|
|
|
const readValues = { ...initialValue, ...formValues };
|
|
|
|
|
const readValues = { ...defaultInitialValue, ...initialValue, ...formValues };
|
|
|
|
|
|
|
|
|
|
const formValuesMapper = values => {
|
|
|
|
|
const destinationObject = {
|
|
|
|
|
|