fix: 财务-明细查询,本公司,添加设置数据范围, 同步官方 (#565)
Reviewed-on: daoyoucloud/tachycode#565 Co-authored-by: bai.jingfeng <bai.jingfeng@foxmail.com> Co-committed-by: bai.jingfeng <bai.jingfeng@foxmail.com>
This commit is contained in:
parent
fac534ebb1
commit
dd38283c91
@ -1,3 +1,4 @@
|
||||
-- 财务-发票管理-明细查询
|
||||
CREATE OR REPLACE VIEW
|
||||
public.view_invoice_all AS
|
||||
SELECT
|
||||
|
@ -1,3 +1,4 @@
|
||||
-- 增值税计算
|
||||
CREATE OR REPLACE VIEW
|
||||
public.view_invoice_tax AS
|
||||
-- 发票进项表和完税凭证表: 1. 筛选所需字段并统一命名,2. 将发票进项表和完税凭证表, 两个表的数据合并
|
||||
|
@ -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 ? (
|
||||
<SchemaSettingsDataScope
|
||||
form={form}
|
||||
collectionName={collectionField.target}
|
||||
defaultFilter={defaultFilter}
|
||||
onSubmit={onSubmit}
|
||||
/>
|
||||
) : 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 (
|
||||
<GeneralSchemaDesigner disableInitializer>
|
||||
{!isCustom && (
|
||||
@ -324,6 +359,7 @@ export const ChartFilterItemDesigner: React.FC = () => {
|
||||
)}
|
||||
<EditTitle />
|
||||
<EditDescription />
|
||||
{isAssociationField && <EditDataScope />}
|
||||
{hasProps && isCustom && <EditProps />}
|
||||
{!isCustom && <EditOperator />}
|
||||
<EditTitleField />
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user