Commit 90421caa by zhaochengxiang

模型导出

parent ed452bed
...@@ -350,13 +350,16 @@ const EditModel = (props) => { ...@@ -350,13 +350,16 @@ const EditModel = (props) => {
const onExportCancel = (val) => { const onExportCancel = (val) => {
setExportParams({ visible: false }) setExportParams({ visible: false })
let _id = (approvalId) ? currentApprovalModelId : modelerData?.id
if (val === 'ddl') { if (val === 'ddl') {
setExportDDLParams({ visible: true }) setExportDDLParams({ visible: true })
} else if (val === 'erwin') { } else if (val === 'erwin') {
dispatch({ dispatch({
type: 'datamodel.exportERWinString', type: 'datamodel.exportERWinString',
payload: { payload: {
ids: modelerData?.id, ids: _id,
}, },
callback: data => { callback: data => {
copy(JSON.stringify(data)); copy(JSON.stringify(data));
...@@ -364,11 +367,11 @@ const EditModel = (props) => { ...@@ -364,11 +367,11 @@ const EditModel = (props) => {
} }
}); });
} else if (val === 'excel') { } else if (val === 'excel') {
window.open(`/api/datamodeler/easyDataModelerExport/excel?ids=${modelerData?.id}`); window.open(`/api/datamodeler/easyDataModelerExport/excel?ids=${_id}`);
} else if (val === 'word') { } else if (val === 'word') {
window.open(`/api/datamodeler/easyDataModelerExport/word/template?ids=${modelerData?.id}`); window.open(`/api/datamodeler/easyDataModelerExport/word/template?ids=${_id}`);
} else if (val === 'basicExcel') { } else if (val === 'basicExcel') {
window.open(`/api/datamodeler/easyDataModelerExport/modelBaseDataExcel?ids=${modelerData?.id}`); window.open(`/api/datamodeler/easyDataModelerExport/modelBaseDataExcel?ids=${_id}`);
} }
} }
...@@ -587,6 +590,9 @@ const EditModel = (props) => { ...@@ -587,6 +590,9 @@ const EditModel = (props) => {
data={approvalData} data={approvalData}
id={currentApprovalModelId} id={currentApprovalModelId}
type={approvalType} type={approvalType}
onExport={() => {
setExportParams({ visible: true })
}}
onHistory={() => { onHistory={() => {
setHistoryAndVersionDrawerVisible(true) setHistoryAndVersionDrawerVisible(true)
}} }}
...@@ -699,7 +705,7 @@ const EditModel = (props) => { ...@@ -699,7 +705,7 @@ const EditModel = (props) => {
<ExportDDLModel <ExportDDLModel
{...exportDDLParams} {...exportDDLParams}
reference='exportDDL' reference='exportDDL'
ids={[modelerData?.id]} ids={(approvalId) ? [currentApprovalModelId] : [modelerData?.id]}
names={[modelerData?.name]} names={[modelerData?.name]}
onCancel={() => { onCancel={() => {
setExportDDLParams({ setExportDDLParams({
...@@ -726,7 +732,7 @@ const EditModel = (props) => { ...@@ -726,7 +732,7 @@ const EditModel = (props) => {
export default EditModel; export default EditModel;
const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk, onHistory }) => { const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk, onHistory, onExport }) => {
const [item, setItem] = useState() const [item, setItem] = useState()
const [waiting, setWaiting] = useState(false) const [waiting, setWaiting] = useState(false)
...@@ -750,6 +756,10 @@ const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk, ...@@ -750,6 +756,10 @@ const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk,
return [0, false, false] return [0, false, false]
}, [data, id]) }, [data, id])
const onExportClick = () => {
onExport?.()
}
const onHistoryClick = () => { const onHistoryClick = () => {
onHistory?.() onHistory?.()
} }
...@@ -795,6 +805,7 @@ const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk, ...@@ -795,6 +805,7 @@ const PhysicalModelApprovalBottom = ({ loading, type, data, id, onChange, onOk,
return ( return (
<div className='flex' style={{ width: '100%', justifyContent: 'space-between' }}> <div className='flex' style={{ width: '100%', justifyContent: 'space-between' }}>
<Space> <Space>
<Button type='primary' ghost onClick={onExportClick}>导出</Button>
<Button type='primary' ghost onClick={onHistoryClick}>历史版本</Button> <Button type='primary' ghost onClick={onHistoryClick}>历史版本</Button>
</Space> </Space>
<Space> <Space>
......
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