feat(sj_1.0.0): 1、工作流导入导出优化 2、导入执行刷新页面
This commit is contained in:
parent
15d19f84c9
commit
6748d5bc24
@ -7,6 +7,12 @@ defineOptions({
|
||||
name: 'FileUpload'
|
||||
});
|
||||
|
||||
const emit = defineEmits<Emits>();
|
||||
|
||||
interface Emits {
|
||||
(e: 'refresh'): void;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
accept?: string;
|
||||
action?: string;
|
||||
@ -51,6 +57,7 @@ const handleImport = ({
|
||||
})
|
||||
.then(() => {
|
||||
onFinish();
|
||||
emit('refresh');
|
||||
})
|
||||
.catch(() => onError());
|
||||
};
|
||||
|
5
src/typings/api.d.ts
vendored
5
src/typings/api.d.ts
vendored
@ -894,6 +894,11 @@ declare namespace Api {
|
||||
Pick<Api.Workflow.Workflow, 'workflowName' | 'groupName' | 'workflowStatus'> & CommonSearchParams
|
||||
>;
|
||||
|
||||
type ExportWorkflow = Common.CommonRecord<{
|
||||
workflowIds: String[];
|
||||
}> &
|
||||
WorkflowSearchParams;
|
||||
|
||||
/** workflow list */
|
||||
type WorkflowList = Common.PaginatingQueryRecord<Workflow>;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ function handleExport() {
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #addAfter>
|
||||
<FileUpload v-if="hasAuth('R_ADMIN')" action="/group/import" accept="application/json" />
|
||||
<FileUpload v-if="hasAuth('R_ADMIN')" action="/group/import" accept="application/json" @refresh="getData" />
|
||||
<NPopconfirm @positive-click="handleExport">
|
||||
<template #trigger>
|
||||
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
|
||||
|
@ -277,7 +277,7 @@ function handleExport() {
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #addAfter>
|
||||
<FileUpload action="/job/import" accept="application/json" />
|
||||
<FileUpload action="/job/import" accept="application/json" @refresh="getData" />
|
||||
<NPopconfirm @positive-click="handleExport">
|
||||
<template #trigger>
|
||||
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
|
||||
|
@ -222,7 +222,7 @@ function handleExport() {
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #addAfter>
|
||||
<FileUpload action="/scene-config/import" accept="application/json" />
|
||||
<FileUpload action="/scene-config/import" accept="application/json" @refresh="getData" />
|
||||
<NPopconfirm @positive-click="handleExport">
|
||||
<template #trigger>
|
||||
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
|
||||
|
@ -33,11 +33,11 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
workflowStatus: null
|
||||
},
|
||||
columns: () => [
|
||||
// {
|
||||
// type: 'selection',
|
||||
// align: 'center',
|
||||
// width: 48
|
||||
// },
|
||||
{
|
||||
type: 'selection',
|
||||
align: 'center',
|
||||
width: 48
|
||||
},
|
||||
{
|
||||
key: 'id',
|
||||
title: $t('common.index'),
|
||||
@ -251,8 +251,17 @@ async function execute(id: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function body(): Api.Workflow.ExportWorkflow {
|
||||
return {
|
||||
workflowIds: checkedRowKeys.value,
|
||||
groupName: searchParams.groupName,
|
||||
workflowName: searchParams.workflowName,
|
||||
workflowStatus: searchParams.workflowStatus
|
||||
};
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
downloadFetch('/workflow/export', checkedRowKeys.value, $t('page.workflow.title'));
|
||||
downloadFetch('/workflow/export', body(), $t('page.workflow.title'));
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -277,7 +286,7 @@ function handleExport() {
|
||||
@refresh="getData"
|
||||
>
|
||||
<template #addAfter>
|
||||
<FileUpload action="/workflow/import" accept="application/json" />
|
||||
<FileUpload action="/workflow/import" accept="application/json" @refresh="getData" />
|
||||
<NPopconfirm @positive-click="handleExport">
|
||||
<template #trigger>
|
||||
<NButton size="small" ghost type="primary" :disabled="checkedRowKeys.length === 0 && hasAuth('R_USER')">
|
||||
|
@ -29,7 +29,7 @@ function search() {
|
||||
<template>
|
||||
<SearchForm :model="model" @search="search" @reset="reset">
|
||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.workflow.groupName')" path="groupName" class="pr-24px">
|
||||
<SelectGroup v-model="model.groupName" />
|
||||
<SelectGroup v-model:value="model.groupName" />
|
||||
</NFormItemGi>
|
||||
<NFormItemGi
|
||||
span="24 s:12 m:6"
|
||||
|
Loading…
Reference in New Issue
Block a user