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 */
type WorkflowBatchSearchParams = CommonType.RecordNullable<
Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'taskBatchStatus'> &
Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'workflowName' | 'taskBatchStatus'> &
CommonSearchParams & { datetimeRange?: [string, string] }
>;

View File

@ -13,6 +13,7 @@ const router = useRouter();
const appStore = useAppStore();
const workflowId = history.state.workflowId;
const workflowName = history.state.workflowName;
const taskBatchStatus = history.state.taskBatchStatus;
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
// the value can not be undefined, otherwise the property in Form will not be reactive
workflowId: null,
workflowName: null,
groupName: null,
taskBatchStatus: null,
datetimeRange: monthRangeISO8601()
},
searchParams: {
workflowId,
workflowName,
taskBatchStatus
},
columns: () => [

View File

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

View File

@ -15,11 +15,13 @@ import StatusSwitch from '@/components/common/status-switch.vue';
import { tagColor } from '@/utils/common';
import { useAuth } from '@/hooks/business/auth';
import { downloadFetch } from '@/utils/download';
import { useRouterPush } from '@/hooks/common/router';
import WorkflowSearch from './modules/workflow-search.vue';
const { hasAuth } = useAuth();
const router = useRouter();
const appStore = useAppStore();
const { routerPushByKey } = useRouterPush();
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchGetWorkflowPageList,
@ -152,7 +154,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
{
label: $t('common.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 } });
}
function batch(id: string) {
router.push({ path: '/workflow/batch', state: { workflowId: id } });
}
// function batch(id: string) {
// router.push({ path: '/workflow/batch', state: { workflowId: id } });
// }
async function execute(id: string) {
const { error } = await fetchTriggerWorkflow(id);
@ -261,6 +263,10 @@ function body(): Api.Workflow.ExportWorkflow {
function handleExport() {
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>
<template>