Merge pull request 'fix: 复制修复' (#614) from fix/action-duplicate into dev
Reviewed-on: daoyoucloud/tachycode#614
This commit is contained in:
commit
7106e21504
@ -4,9 +4,7 @@ import {
|
|||||||
ActionContextProvider,
|
ActionContextProvider,
|
||||||
CollectionProvider_deprecated,
|
CollectionProvider_deprecated,
|
||||||
RecordProvider,
|
RecordProvider,
|
||||||
CollectionProvider,
|
|
||||||
FormBlockContext,
|
FormBlockContext,
|
||||||
CollectionRecordProvider,
|
|
||||||
fetchTemplateData,
|
fetchTemplateData,
|
||||||
useAPIClient,
|
useAPIClient,
|
||||||
useActionContext,
|
useActionContext,
|
||||||
@ -17,7 +15,7 @@ import {
|
|||||||
useFormBlockContext,
|
useFormBlockContext,
|
||||||
useCollectionParentRecordData,
|
useCollectionParentRecordData,
|
||||||
useRecord,
|
useRecord,
|
||||||
useCollectionRecord,
|
useCollection,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
import { App, Button } from 'antd';
|
import { App, Button } from 'antd';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
@ -78,16 +76,21 @@ export const DuplicateAction = observer(
|
|||||||
const { duplicateFields, duplicateMode = 'quickDulicate', duplicateCollection } = fieldSchema['x-component-props'];
|
const { duplicateFields, duplicateMode = 'quickDulicate', duplicateCollection } = fieldSchema['x-component-props'];
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
const parentRecordData = useCollectionParentRecordData();
|
const parentRecordData = useCollectionParentRecordData();
|
||||||
const { id, __collection } = record;
|
const { __collection } = record;
|
||||||
const ctx = useActionContext();
|
const ctx = useActionContext();
|
||||||
const { name } = useCollection_deprecated();
|
const { name } = useCollection_deprecated();
|
||||||
const { getCollectionFields } = useCollectionManager_deprecated();
|
const { getCollectionFields } = useCollectionManager_deprecated();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const collectionFields = getCollectionFields(__collection || name);
|
const collectionFields = getCollectionFields(__collection || name);
|
||||||
const formctx = useFormBlockContext();
|
const formctx = useFormBlockContext();
|
||||||
|
|
||||||
|
// 获取当前数据表的主键
|
||||||
|
const collection = useCollection();
|
||||||
|
const primaryKey = collection?.getPrimaryKey();
|
||||||
|
|
||||||
const template = {
|
const template = {
|
||||||
key: 'duplicate',
|
key: 'duplicate',
|
||||||
dataId: id,
|
dataId: record[primaryKey],
|
||||||
default: true,
|
default: true,
|
||||||
fields:
|
fields:
|
||||||
duplicateFields?.filter((v) => {
|
duplicateFields?.filter((v) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user