diff --git a/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql index 19689377c..2235730fc 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql +++ b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices.sql @@ -1,3 +1,4 @@ +-- 财务-发票管理-明细查询 CREATE OR REPLACE VIEW public.view_invoice_all AS SELECT diff --git a/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices_tax.sql b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices_tax.sql index 52978dffb..28b7b111a 100644 --- a/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices_tax.sql +++ b/packages/plugins/@hera/plugin-rental/src/server/sqls/view_invoices_tax.sql @@ -1,3 +1,4 @@ +-- 增值税计算 CREATE OR REPLACE VIEW public.view_invoice_tax AS -- 发票进项表和完税凭证表: 1. 筛选所需字段并统一命名,2. 将发票进项表和完税凭证表, 两个表的数据合并 diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemDesigner.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemDesigner.tsx index 4e29baa32..d5bf2211d 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemDesigner.tsx +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/filter/FilterItemDesigner.tsx @@ -14,6 +14,10 @@ import { SchemaSettingsSelectItem, CollectionFieldOptions_deprecated, DEFAULT_DATA_SOURCE_KEY, + SchemaSettingsDataScope, + useFormBlockContext, + removeNullCondition, + useIsAssociationField, } from '@nocobase/client'; import { useChartsTranslation } from '../locale'; import { Schema, useField, useFieldSchema } from '@formily/react'; @@ -299,6 +303,36 @@ const EditTitleField = () => { ) : null; }; +const EditDataScope = () => { + const { form } = useFormBlockContext(); + const fieldSchema = useFieldSchema(); + const dataSource = fieldSchema['x-data-source'] || DEFAULT_DATA_SOURCE_KEY; + const { cm } = useChartDataSource(dataSource); + const field = useField(); + const { dn } = useDesignable(); + const collectionField = cm.getCollectionField(fieldSchema['x-collection-field']); + const defaultFilter = fieldSchema?.['x-component-props']?.params?.filter || {}; + const onSubmit = ({ filter }) => { + filter = removeNullCondition(filter); + _.set(field.componentProps, 'service.params.filter', filter); + fieldSchema['x-component-props'] = field.componentProps; + dn.emit('patch', { + schema: { + ['x-uid']: fieldSchema['x-uid'], + 'x-component-props': fieldSchema['x-component-props'], + }, + }); + }; + return collectionField ? ( + + ) : null; +}; + export const ChartFilterItemDesigner: React.FC = () => { const { getCollectionJoinField } = useCollectionManager_deprecated(); const { getField } = useCollection_deprecated(); @@ -310,6 +344,7 @@ export const ChartFilterItemDesigner: React.FC = () => { const isCustom = fieldName.startsWith('custom.'); const hasProps = getPropsSchemaByComponent(fieldSchema['x-component']); const originalTitle = useCollectionJoinFieldTitle(dataSource, fieldName); + const isAssociationField = useIsAssociationField(); return ( {!isCustom && ( @@ -324,6 +359,7 @@ export const ChartFilterItemDesigner: React.FC = () => { )} + {isAssociationField && } {hasProps && isCustom && } {!isCustom && } diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/hooks/filter.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/hooks/filter.ts index 0edbdae1f..d10b68799 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/hooks/filter.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/hooks/filter.ts @@ -221,7 +221,7 @@ export const useChartFilter = () => { name: string, fieldName: string, ): SchemaInitializerItemType => { - if (!field.interface) { + if (!field.interface || field.isForeignKey) { return; } const fieldInterface = fim.getFieldInterface(field.interface);