feat(bpm):新增流程模型操作导出模型json按钮
This commit is contained in:
@@ -107,6 +107,11 @@ export async function importModel(file: File, key?: string, name?: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出流程模型 */
|
||||
export async function exportModel(id: number) {
|
||||
return requestClient.get<BpmModelApi.Model>(`/bpm/model/export?id=${id}`);
|
||||
}
|
||||
|
||||
/** 删除流程模型 */
|
||||
export async function deleteModel(id: number) {
|
||||
return requestClient.delete(`/bpm/model/delete?id=${id}`);
|
||||
|
||||
@@ -31,6 +31,7 @@ import {
|
||||
cleanModel,
|
||||
deleteModel,
|
||||
deployModel,
|
||||
exportModel,
|
||||
updateModelSortBatch,
|
||||
updateModelState,
|
||||
} from '#/api/bpm/model';
|
||||
@@ -315,6 +316,10 @@ function handleModelCommand(command: string, row: any) {
|
||||
handleDelete(row);
|
||||
break;
|
||||
}
|
||||
case 'handleExport': {
|
||||
handleExportModel(row);
|
||||
break;
|
||||
}
|
||||
case 'handleReport': {
|
||||
handleReport(row);
|
||||
break;
|
||||
@@ -325,6 +330,26 @@ function handleModelCommand(command: string, row: any) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 导出模型 */
|
||||
async function handleExportModel(row: any) {
|
||||
const hideLoading = message.loading({ content: '正在导出...', duration: 0 });
|
||||
try {
|
||||
const data = await exportModel(row.id);
|
||||
const blob = new Blob([JSON.stringify(data, null, 2)], {
|
||||
type: 'application/json',
|
||||
});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `${row.key || row.name || 'model'}.json`;
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
message.success('导出成功');
|
||||
} finally {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
/** 更新状态操作 */
|
||||
async function handleChangeState(row: any) {
|
||||
const state = row.processDefinition.suspensionState;
|
||||
@@ -691,6 +716,7 @@ function handleRenameSuccess() {
|
||||
@click="(e) => handleModelCommand(e.key as string, row)"
|
||||
>
|
||||
<Menu.Item key="handleCopy"> 复制 </Menu.Item>
|
||||
<Menu.Item key="handleExport"> 导出 </Menu.Item>
|
||||
<Menu.Item key="handleDefinitionList"> 历史 </Menu.Item>
|
||||
|
||||
<Menu.Item
|
||||
|
||||
Reference in New Issue
Block a user