Commit 12adaf2a by zhaochengxiang

新增元数据导入

parent 3c3aa7d0
...@@ -9,11 +9,15 @@ import SelectAsset from './select-asset'; ...@@ -9,11 +9,15 @@ import SelectAsset from './select-asset';
import { dispatchLatest } from '../../../../model'; import { dispatchLatest } from '../../../../model';
import { isSzseEnv } from '../../../../util'; import { isSzseEnv } from '../../../../util';
import { AppContext } from '../../../../App';
import IframeDrawer from '../../ModelConfig/Component/IframeDrawer';
import { Action, CatalogId, MetadataId } from '../../../../util/constant';
const importModes = [ const importModes = [
{ name: '快速创建', key: 'excel-copy' }, { name: '快速创建', key: 'excel-copy' },
{ name: '空白创建', key: 'no-condition' }, { name: '空白创建', key: 'no-condition' },
{ name: '资产导入', key: 'asset-import' }, { name: '资产导入', key: 'asset-import' },
{ name: '元数据导入', key: 'metadata-import' },
// { name: 'Word导入', key: 'word' }, // { name: 'Word导入', key: 'word' },
// { name: 'Excel导入', key: 'excel' }, // { name: 'Excel导入', key: 'excel' },
// { name: 'DDL导入', key: 'ddl' }, // { name: 'DDL导入', key: 'ddl' },
...@@ -30,7 +34,13 @@ const ImportModal = (props) => { ...@@ -30,7 +34,13 @@ const ImportModal = (props) => {
visible: false, visible: false,
catalogId: undefined, catalogId: undefined,
}) })
const [iframeDrawerParams, setIframeDrawerParams] = React.useState({
visible: false,
title: undefined,
url: undefined,
})
const app = React.useContext(AppContext)
const [ form ] = Form.useForm(); const [ form ] = Form.useForm();
const onModeChange = (e) => { const onModeChange = (e) => {
...@@ -92,8 +102,20 @@ const ImportModal = (props) => { ...@@ -92,8 +102,20 @@ const ImportModal = (props) => {
onCancelByDDL && onCancelByDDL(true, ddl); onCancelByDDL && onCancelByDDL(true, ddl);
} else if (modeKey === 'asset-import') { } else if (modeKey === 'asset-import') {
setSelectAssetParams({ visible: true, catalogId }) setSelectAssetParams({ visible: true, catalogId })
} else if (modeKey === 'metadata-import') {
app?.setGlobalState?.({
message: 'data-govern-show-select-metadata',
data: {
cb: (val) => {
setIframeDrawerParams({
visible: true,
title: '新增模型',
url: `/data-govern/data-model-action?${Action}=add&${MetadataId}=${val}&${CatalogId}=${catalogId??''}`,
})
}
}
})
} }
} catch (errInfo) { } catch (errInfo) {
console.log('Validate Failed:', errInfo); console.log('Validate Failed:', errInfo);
} }
...@@ -215,6 +237,16 @@ const ImportModal = (props) => { ...@@ -215,6 +237,16 @@ const ImportModal = (props) => {
setSelectAssetParams({ visible: false, catalogId: undefined }) setSelectAssetParams({ visible: false, catalogId: undefined })
}} }}
/> />
{ iframeDrawerParams.visible && <IframeDrawer
{...iframeDrawerParams}
onCancel={() => {
setIframeDrawerParams({
visible: false,
title: undefined,
url: undefined,
})
}}
/> }
</> </>
) )
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment