feat(sj_1.0.0): 完成工作流批次展示
This commit is contained in:
parent
64a4e77ddf
commit
ed9503217c
@ -7,7 +7,8 @@ export * from './system-manage';
|
|||||||
export * from './notify';
|
export * from './notify';
|
||||||
export * from './group';
|
export * from './group';
|
||||||
export * from './retry-task';
|
export * from './retry-task';
|
||||||
export * from './retry';
|
export * from './retry-scene';
|
||||||
|
export * from './retry-log';
|
||||||
export * from './retry-dead-letter';
|
export * from './retry-dead-letter';
|
||||||
export * from './workflow';
|
export * from './workflow';
|
||||||
export * from './job';
|
export * from './job';
|
||||||
|
35
src/service/api/retry-log.ts
Normal file
35
src/service/api/retry-log.ts
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { request } from '../request';
|
||||||
|
|
||||||
|
/** get retry log list */
|
||||||
|
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
||||||
|
return request<Api.RetryLog.RetryLogList>({
|
||||||
|
url: '/retry-task-log/list',
|
||||||
|
method: 'get',
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** get retry log list */
|
||||||
|
export function fetchRetryLogById(id: string) {
|
||||||
|
return request<Api.RetryLog.RetryLog>({
|
||||||
|
url: `/retry-task-log/${id}`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** delete retry log */
|
||||||
|
export function fetchDeleteRetryLog(id: number) {
|
||||||
|
return request<boolean>({
|
||||||
|
url: `/retry-task-log/${id}`,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** delete retry log */
|
||||||
|
export function fetchBatchDeleteRetryLog(ids: number[]) {
|
||||||
|
return request<boolean>({
|
||||||
|
url: `/retry-task-log/ids`,
|
||||||
|
method: 'delete',
|
||||||
|
data: ids
|
||||||
|
});
|
||||||
|
}
|
@ -43,37 +43,3 @@ export function fetchUpdateSceneStatus(id: string, status: Api.Common.EnableStat
|
|||||||
method: 'put'
|
method: 'put'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** get retry log list */
|
|
||||||
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
|
|
||||||
return request<Api.RetryLog.RetryLogList>({
|
|
||||||
url: '/retry-task-log/list',
|
|
||||||
method: 'get',
|
|
||||||
params
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** get retry log list */
|
|
||||||
export function fetchRetryLogById(id: string) {
|
|
||||||
return request<Api.RetryLog.RetryLog>({
|
|
||||||
url: `/retry-task-log/${id}`,
|
|
||||||
method: 'get'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** delete retry log */
|
|
||||||
export function fetchDeleteRetryLog(id: number) {
|
|
||||||
return request<boolean>({
|
|
||||||
url: `/retry-task-log/${id}`,
|
|
||||||
method: 'delete'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** delete retry log */
|
|
||||||
export function fetchBatchDeleteRetryLog(ids: number[]) {
|
|
||||||
return request<boolean>({
|
|
||||||
url: `/retry-task-log/ids`,
|
|
||||||
method: 'delete',
|
|
||||||
data: ids
|
|
||||||
});
|
|
||||||
}
|
|
@ -34,3 +34,17 @@ export function fetchGetWorkflowBatchList(params?: Api.WorkflowBatch.WorkflowBat
|
|||||||
params
|
params
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fetchUpdateWorkflowStatus(id: string) {
|
||||||
|
return request({
|
||||||
|
url: `/workflow/update/status/${id}`,
|
||||||
|
method: 'put'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchDelWorkflow(id: string) {
|
||||||
|
return request({
|
||||||
|
url: `/workflow/${id}`,
|
||||||
|
method: 'delete'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -59,7 +59,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
width: 80,
|
width: 80,
|
||||||
render: row => {
|
render: row => {
|
||||||
const fetchFn = async (groupStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
|
const fetchFn = async (groupStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
|
||||||
const { error } = await fetchUpdateGroupStatus({ groupName: row.groupName, groupStatus: row.groupStatus });
|
const status = row.groupStatus === 1 ? 0 : 1;
|
||||||
|
const { error } = await fetchUpdateGroupStatus({ groupName: row.groupName, groupStatus: status });
|
||||||
if (!error) {
|
if (!error) {
|
||||||
row.groupStatus = groupStatus;
|
row.groupStatus = groupStatus;
|
||||||
window.$message?.success($t('common.updateSuccess'));
|
window.$message?.success($t('common.updateSuccess'));
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NButton, NPopconfirm } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { fetchGetWorkflowBatchList } from '@/service/api';
|
import { fetchGetWorkflowBatchList } from '@/service/api';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
|
import { operationReasonRecord, taskBatchStatusRecord } from '@/constants/business';
|
||||||
import WorkflowBatchSearch from './modules/workflow-batch-search.vue';
|
import WorkflowBatchSearch from './modules/workflow-batch-search.vue';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
@ -53,13 +54,38 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
key: 'taskBatchStatus',
|
key: 'taskBatchStatus',
|
||||||
title: $t('page.workflowBatch.taskBatchStatus'),
|
title: $t('page.workflowBatch.taskBatchStatus'),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
|
render: row => {
|
||||||
|
if (!row.taskBatchStatus) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tagMap: Record<number, NaiveUI.ThemeColor> = {
|
||||||
|
1: 'info',
|
||||||
|
2: 'success',
|
||||||
|
3: 'warning',
|
||||||
|
4: 'error',
|
||||||
|
5: 'error',
|
||||||
|
6: 'warning'
|
||||||
|
};
|
||||||
|
|
||||||
|
const label = $t(taskBatchStatusRecord[row.taskBatchStatus!]);
|
||||||
|
return <NTag type={tagMap[row.taskBatchStatus]}>{label}</NTag>;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'operationReason',
|
key: 'operationReason',
|
||||||
title: $t('page.workflowBatch.operationReason'),
|
title: $t('page.workflowBatch.operationReason'),
|
||||||
align: 'left',
|
align: 'left',
|
||||||
minWidth: 120
|
minWidth: 120,
|
||||||
|
render: row => {
|
||||||
|
if (!row.operationReason) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const label = $t(operationReasonRecord[row.operationReason!]);
|
||||||
|
return <NTag type="warning">{label}</NTag>;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'createDt',
|
key: 'createDt',
|
||||||
@ -94,9 +120,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
drawerVisible,
|
|
||||||
operateType,
|
|
||||||
editingData,
|
|
||||||
handleAdd,
|
handleAdd,
|
||||||
handleEdit,
|
handleEdit,
|
||||||
checkedRowKeys,
|
checkedRowKeys,
|
||||||
@ -139,6 +162,7 @@ function edit(id: string) {
|
|||||||
v-model:columns="columnChecks"
|
v-model:columns="columnChecks"
|
||||||
:disabled-delete="checkedRowKeys.length === 0"
|
:disabled-delete="checkedRowKeys.length === 0"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
:show-delete="false"
|
||||||
@add="handleAdd"
|
@add="handleAdd"
|
||||||
@delete="handleBatchDelete"
|
@delete="handleBatchDelete"
|
||||||
@refresh="getData"
|
@refresh="getData"
|
||||||
@ -156,12 +180,6 @@ function edit(id: string) {
|
|||||||
:pagination="mobilePagination"
|
:pagination="mobilePagination"
|
||||||
class="sm:h-full"
|
class="sm:h-full"
|
||||||
/>
|
/>
|
||||||
<WorkflowBatchOperateDrawer
|
|
||||||
v-model:visible="drawerVisible"
|
|
||||||
:operate-type="operateType"
|
|
||||||
:row-data="editingData"
|
|
||||||
@submitted="getData"
|
|
||||||
/>
|
|
||||||
</NCard>
|
</NCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,11 +1,18 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import { fetchGetWorkflowPageList, fetchTriggerWorkflow } from '@/service/api';
|
import {
|
||||||
|
fetchDelWorkflow,
|
||||||
|
fetchGetWorkflowPageList,
|
||||||
|
fetchTriggerWorkflow,
|
||||||
|
fetchUpdateWorkflowStatus
|
||||||
|
} from '@/service/api';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
import { enableStatusNumberRecord, triggerTypeRecord } from '@/constants/business';
|
import { triggerTypeRecord } from '@/constants/business';
|
||||||
|
import StatusSwitch from '@/components/common/status-switch.vue';
|
||||||
|
import { tagColor } from '@/utils/common';
|
||||||
import WorkflowSearch from './modules/workflow-search.vue';
|
import WorkflowSearch from './modules/workflow-search.vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@ -23,11 +30,11 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
workflowStatus: null
|
workflowStatus: null
|
||||||
},
|
},
|
||||||
columns: () => [
|
columns: () => [
|
||||||
{
|
// {
|
||||||
type: 'selection',
|
// type: 'selection',
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
width: 48
|
// width: 48
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
key: 'index',
|
key: 'index',
|
||||||
title: $t('common.index'),
|
title: $t('common.index'),
|
||||||
@ -69,12 +76,16 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
render: row => {
|
render: row => {
|
||||||
if (!row.workflowStatus) {
|
const fetchFn = async (workflowStatus: Api.Common.EnableStatusNumber, callback: () => void) => {
|
||||||
return null;
|
const { error } = await fetchUpdateWorkflowStatus(row.id!);
|
||||||
}
|
if (!error) {
|
||||||
|
row.workflowStatus = workflowStatus;
|
||||||
|
window.$message?.success($t('common.updateSuccess'));
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
};
|
||||||
|
|
||||||
const label = $t(enableStatusNumberRecord[row.workflowStatus!]);
|
return <StatusSwitch v-model:value={row.workflowStatus} onFetch={fetchFn} />;
|
||||||
return <NTag type="primary">{label}</NTag>;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -88,7 +99,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
}
|
}
|
||||||
|
|
||||||
const label = $t(triggerTypeRecord[row.triggerType!]);
|
const label = $t(triggerTypeRecord[row.triggerType!]);
|
||||||
return <NTag type="primary">{label}</NTag>;
|
return <NTag type={tagColor(row.triggerType)}>{label}</NTag>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -147,8 +158,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
checkedRowKeys,
|
checkedRowKeys,
|
||||||
onBatchDeleted,
|
onBatchDeleted
|
||||||
onDeleted
|
|
||||||
// closeDrawer
|
// closeDrawer
|
||||||
} = useTableOperate(data, getData);
|
} = useTableOperate(data, getData);
|
||||||
|
|
||||||
@ -159,11 +169,13 @@ async function handleBatchDelete() {
|
|||||||
onBatchDeleted();
|
onBatchDeleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(id: string) {
|
async function handleDelete(id: string) {
|
||||||
// request
|
// request
|
||||||
console.log(id);
|
const { error } = await fetchDelWorkflow(id!);
|
||||||
|
if (!error) {
|
||||||
onDeleted();
|
window.$message?.success($t('common.deleteSuccess'));
|
||||||
|
getData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit(id: string) {
|
function edit(id: string) {
|
||||||
@ -210,6 +222,7 @@ async function execute(id: string) {
|
|||||||
v-model:columns="columnChecks"
|
v-model:columns="columnChecks"
|
||||||
:disabled-delete="checkedRowKeys.length === 0"
|
:disabled-delete="checkedRowKeys.length === 0"
|
||||||
:loading="loading"
|
:loading="loading"
|
||||||
|
:show-delete="false"
|
||||||
@add="handleAdd"
|
@add="handleAdd"
|
||||||
@delete="handleBatchDelete"
|
@delete="handleBatchDelete"
|
||||||
@refresh="getData"
|
@refresh="getData"
|
||||||
|
Loading…
Reference in New Issue
Block a user