feat(sj_1.1.0-beta1): 完成工作流从任务跳转到批次页面时自动填充任务名称

This commit is contained in:
opensnail 2024-06-22 18:24:24 +08:00
parent 91b1eca3ca
commit 121ac94cff
4 changed files with 15 additions and 6 deletions

View File

@ -1126,7 +1126,7 @@ declare namespace Api {
/** workflowBatch search params */ /** workflowBatch search params */
type WorkflowBatchSearchParams = CommonType.RecordNullable< type WorkflowBatchSearchParams = CommonType.RecordNullable<
Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'taskBatchStatus'> & Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'workflowName' | 'taskBatchStatus'> &
CommonSearchParams & { datetimeRange?: [string, string] } CommonSearchParams & { datetimeRange?: [string, string] }
>; >;

View File

@ -13,6 +13,7 @@ const router = useRouter();
const appStore = useAppStore(); const appStore = useAppStore();
const workflowId = history.state.workflowId; const workflowId = history.state.workflowId;
const workflowName = history.state.workflowName;
const taskBatchStatus = history.state.taskBatchStatus; const taskBatchStatus = history.state.taskBatchStatus;
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({ const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
@ -23,12 +24,14 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
// if you want to use the searchParams in Form, you need to define the following properties, and the value is null // if you want to use the searchParams in Form, you need to define the following properties, and the value is null
// the value can not be undefined, otherwise the property in Form will not be reactive // the value can not be undefined, otherwise the property in Form will not be reactive
workflowId: null, workflowId: null,
workflowName: null,
groupName: null, groupName: null,
taskBatchStatus: null, taskBatchStatus: null,
datetimeRange: monthRangeISO8601() datetimeRange: monthRangeISO8601()
}, },
searchParams: { searchParams: {
workflowId, workflowId,
workflowName,
taskBatchStatus taskBatchStatus
}, },
columns: () => [ columns: () => [

View File

@ -15,7 +15,6 @@ interface Emits {
(e: 'reset'): void; (e: 'reset'): void;
(e: 'search'): void; (e: 'search'): void;
} }
const keywords = ref<string>('');
const noSearchFlag = ref(false); const noSearchFlag = ref(false);
const emit = defineEmits<Emits>(); const emit = defineEmits<Emits>();
@ -23,6 +22,7 @@ const emit = defineEmits<Emits>();
const workflowList = ref<Api.Workflow.Workflow[]>([]); const workflowList = ref<Api.Workflow.Workflow[]>([]);
const model = defineModel<Api.WorkflowBatch.WorkflowBatchSearchParams>('model', { required: true }); const model = defineModel<Api.WorkflowBatch.WorkflowBatchSearchParams>('model', { required: true });
const keywords = ref<string>(model.value.workflowName as any);
function reset() { function reset() {
keywords.value = ''; keywords.value = '';

View File

@ -15,11 +15,13 @@ import StatusSwitch from '@/components/common/status-switch.vue';
import { tagColor } from '@/utils/common'; import { tagColor } from '@/utils/common';
import { useAuth } from '@/hooks/business/auth'; import { useAuth } from '@/hooks/business/auth';
import { downloadFetch } from '@/utils/download'; import { downloadFetch } from '@/utils/download';
import { useRouterPush } from '@/hooks/common/router';
import WorkflowSearch from './modules/workflow-search.vue'; import WorkflowSearch from './modules/workflow-search.vue';
const { hasAuth } = useAuth(); const { hasAuth } = useAuth();
const router = useRouter(); const router = useRouter();
const appStore = useAppStore(); const appStore = useAppStore();
const { routerPushByKey } = useRouterPush();
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({ const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchGetWorkflowPageList, apiFn: fetchGetWorkflowPageList,
@ -152,7 +154,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
{ {
label: $t('common.batchList'), label: $t('common.batchList'),
key: 'batchList', key: 'batchList',
click: () => batch(row.id!) click: () => goToBatch(row.id!)
} }
]; ];
@ -237,9 +239,9 @@ function copy(id: string) {
router.push({ path: '/workflow/form/copy', query: { id } }); router.push({ path: '/workflow/form/copy', query: { id } });
} }
function batch(id: string) { // function batch(id: string) {
router.push({ path: '/workflow/batch', state: { workflowId: id } }); // router.push({ path: '/workflow/batch', state: { workflowId: id } });
} // }
async function execute(id: string) { async function execute(id: string) {
const { error } = await fetchTriggerWorkflow(id); const { error } = await fetchTriggerWorkflow(id);
@ -261,6 +263,10 @@ function body(): Api.Workflow.ExportWorkflow {
function handleExport() { function handleExport() {
downloadFetch('/workflow/export', body(), $t('page.workflow.title')); downloadFetch('/workflow/export', body(), $t('page.workflow.title'));
} }
function goToBatch(workflowId: string) {
const findItem = data.value.find(item => item.id === workflowId)!;
routerPushByKey('workflow_batch', { state: { workflowId, workflowName: findItem.workflowName } });
}
</script> </script>
<template> <template>