Commit 67d00570 by zhaochengxiang

服务增加导出

parent 12227dd8
...@@ -164,3 +164,7 @@ export function* getImportLogs(payload) { ...@@ -164,3 +164,7 @@ export function* getImportLogs(payload) {
export function* exportAll(payload) { export function* exportAll(payload) {
return yield call(pds.exportAll, payload); return yield call(pds.exportAll, payload);
} }
export function* exportServices(payload) {
return yield call(pds.exportServices, payload);
}
\ No newline at end of file
import { PostFile, GetJSON, PostJSON, Post, Get, GetJSONRaw, callFetchRawByFormData, callFetchRaw } from "../util/axios" import { PostFile, GetJSON, PostJSON, Post, Get, GetJSONRaw, callFetchRawByFormData, callFetchRaw } from "../util/axios"
import qs from 'qs';
import { ContextPath } from "../util"; import { ContextPath } from "../util";
export function refreshCatalog() { export function refreshCatalog() {
...@@ -164,3 +165,9 @@ export function getImportLogs(payload) { ...@@ -164,3 +165,9 @@ export function getImportLogs(payload) {
export function exportAll(payload) { export function exportAll(payload) {
return callFetchRaw('post', '/pdataservice/pdsCURD/export/all', payload) return callFetchRaw('post', '/pdataservice/pdsCURD/export/all', payload)
} }
export function exportServices(payload) {
return callFetchRaw('post', '/pdataservice/pdsCURD/export/ids', {...payload, paramsSerializer: function (params) {
return qs.stringify(params, { arrayFormat: 'repeat' })
}})
}
\ No newline at end of file
...@@ -377,7 +377,9 @@ class Model extends React.Component { ...@@ -377,7 +377,9 @@ class Model extends React.Component {
onExportClick = () => { onExportClick = () => {
const { modal } = this.props; const { modal } = this.props;
const { catalogId } = this.state; const { catalogId, selectModelerIds } = this.state;
if ((selectModelerIds??[]).length === 0) {
modal?.confirm({ modal?.confirm({
title: '提示', title: '提示',
content: '是否确认导表格中所有数据?', content: '是否确认导表格中所有数据?',
...@@ -398,6 +400,28 @@ class Model extends React.Component { ...@@ -398,6 +400,28 @@ class Model extends React.Component {
}) })
}, },
}); });
} else {
modal?.confirm({
title: '提示',
content: `是否确认导出选中服务, (${(selectModelerIds??[]).length}) ?`,
onOk: () => {
dispatch({
type: 'pds.exportServices',
payload: {
responseType: 'blob',
params: {
pdsDataServiceCatalogId: catalogId,
namespace: this.props.app?.env?.domainId,
ids: selectModelerIds
}
},
callback: (res) => {
download(res)
}
})
},
});
}
} }
onSubscribeBtnClick = () => { onSubscribeBtnClick = () => {
...@@ -778,9 +802,9 @@ class Model extends React.Component { ...@@ -778,9 +802,9 @@ class Model extends React.Component {
(getDataModelerRole(app?.user)!==DataModelerRoleReader) && !isOnlyEnding && <Button onClick={this.onImportClick}>导入</Button> (getDataModelerRole(app?.user)!==DataModelerRoleReader) && !isOnlyEnding && <Button onClick={this.onImportClick}>导入</Button>
} }
{ {
(getDataModelerRole(app?.user)!==DataModelerRoleReader) && !isOnlyEnding && (currentView==='dir') && (getDataModelerRole(app?.user)!==DataModelerRoleReader) && (currentView==='dir') &&
<Tooltip title={this.state.isRoot?'请先选择目录':''}> <Tooltip title={this.state.isRoot&&(this.state.selectModelerIds??[]).length===0?'请先选择目录或者服务':''}>
<Button onClick={this.onExportClick} disabled={this.state.isRoot}>导出</Button> <Button onClick={this.onExportClick} disabled={this.state.isRoot&&(this.state.selectModelerIds??[]).length===0}>导出</Button>
</Tooltip> </Tooltip>
} }
{ {
......
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