feat(sj_1.0.0): cron表达式添加placement

This commit is contained in:
opensnail 2024-04-24 23:31:51 +08:00
parent 5dca558cad
commit 9f29ffabfc
10 changed files with 346 additions and 8 deletions

View File

@ -740,6 +740,26 @@ const local: App.I18n.Schema = {
random: '随机等待'
}
},
retryLog: {
title: 'RetryLog List',
UniqueId: 'UniqueId',
groupName: 'Group name',
sceneName: 'Scene name',
retryStatus: 'Retry status',
taskType: 'Task type',
idempotentId: 'Idempotent ID',
bizNo: 'Business Number',
createDt: 'Creation time',
form: {
groupName: 'Please enter Group name',
idempotentId: 'Please enter Idempotent ID',
sceneName: 'Please enter Scene name',
bizNo: 'Please enter Business Number',
UniqueId: 'Please enter UniqueId'
},
addRetryLog: 'Add Retry log',
editRetryLog: 'Add Retry log'
},
workflowBatch: {
title: 'Workflow Batch List',
workflowName: 'Workflow name',

View File

@ -736,6 +736,26 @@ const local: App.I18n.Schema = {
random: '随机等待'
}
},
retryLog: {
title: 'RetryLog 列表',
UniqueId: 'UniqueId',
groupName: '组名称',
sceneName: '场景名称',
retryStatus: '重试状态',
taskType: '任务类型',
idempotentId: '幂等id',
bizNo: '业务编号',
createDt: '创建时间',
form: {
groupName: '请输入组名称',
idempotentId: '请输入幂等id',
sceneName: '请输入场景名称',
bizNo: '请输入业务编号',
UniqueId: '请输入UniqueId'
},
addRetryLog: '新增重试日志',
editRetryLog: '编辑重试日志'
},
workflow: {
title: '工作流列表',
workflowName: '工作流名称',

View File

@ -43,3 +43,12 @@ export function fetchUpdateSceneStatus(id: number, status: number) {
method: 'put'
});
}
/** update retry log list */
export function fetchRetryLogPageList(params?: Api.RetryLog.RetryLogSearchParams) {
return request<Api.RetryLog.RetryLogList>({
url: '/retry-task-log/list',
method: 'put',
params
});
}

50
src/typings/api.d.ts vendored
View File

@ -822,6 +822,7 @@ declare namespace Api {
* backend api module: "jobTask"
*/
namespace Job {
import EnableStatusNumber = Api.Common.EnableStatusNumber;
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'page' | 'size'>;
/** Job */
@ -839,7 +840,7 @@ declare namespace Api {
/** 下次触发时间 */
nextTriggerAt: string;
/** 状态 */
jobStatus: string;
jobStatus: EnableStatusNumber;
/** 路由策略 */
routeKey: string;
/** 执行器类型 */
@ -916,19 +917,60 @@ declare namespace Api {
/** 执行时间 */
executionAt: string;
/** 状态 */
taskBatchStatus: string;
taskBatchStatus: Common.TaskBatchStatus;
/** 操作原因 */
operationReason: string;
operationReason: Common.OperationReason;
/** 创建时间 */
createDt: string;
}>;
/** workflowBatch search params */
type WorkflowBatchSearchParams = CommonType.RecordNullable<
Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'taskBatchStatus'> & CommonSearchParams
Pick<Api.WorkflowBatch.WorkflowBatch, 'workflowId' | 'groupName' | 'taskBatchStatus' | 'operationReason'> &
CommonSearchParams
>;
/** workflowBatch list */
type WorkflowBatchList = Common.PaginatingQueryRecord<WorkflowBatch>;
}
/**
* namespace RetryLog
*
* backend api module: "retryLog"
*/
namespace RetryLog {
import RetryStatusType = Api.RetryTask.RetryStatusType;
import TaskType = Api.RetryTask.TaskType;
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'page' | 'size'>;
/** retryLog */
type RetryLog = Common.CommonRecord<{
/** UniqueId */
UniqueId: string;
/** 组名称 */
groupName: string;
/** 场景名称 */
sceneName: string;
/** 重试状态 */
retryStatus: RetryStatusType;
/** 任务类型 */
taskType: TaskType;
/** 幂等id */
idempotentId: string;
/** 业务编号 */
bizNo: string;
/** 创建时间 */
createDt: string;
}>;
/** retryLog search params */
type RetryLogSearchParams = CommonType.RecordNullable<
Pick<Api.RetryLog.RetryLog, 'UniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo'> &
CommonSearchParams
>;
/** retryLog list */
type RetryLogList = Common.PaginatingQueryRecord<RetryLog>;
}
}

20
src/typings/app.d.ts vendored
View File

@ -903,6 +903,26 @@ declare namespace App {
random: string;
};
};
retryLog: {
title: string;
UniqueId: string;
groupName: string;
sceneName: string;
retryStatus: string;
taskType: string;
idempotentId: string;
bizNo: string;
createDt: string;
form: {
groupName: string;
idempotentId: string;
sceneName: string;
bizNo: string;
UniqueId: string;
};
addRetryLog: string;
editRetryLog: string;
};
workflow: {
title: string;
workflowName: string;

View File

@ -3,6 +3,8 @@ import { computed, reactive, watch } from 'vue';
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
import OperateDrawer from '@/components/common/operate-drawer.vue';
import { $t } from '@/locales';
import { translateOptions } from '@/utils/common';
import { enableStatusNumberOptions } from '@/constants/business';
// import { fetchAddJobTask, fetchEditJobTask } from '@/service/api';
defineOptions({
@ -67,7 +69,7 @@ function createDefaultModel(): Model {
jobName: '',
argsStr: '',
argsType: '',
jobStatus: '',
jobStatus: 0,
routeKey: '',
executorType: '',
triggerType: '',
@ -171,7 +173,11 @@ watch(visible, () => {
<NInput v-model:value="model.jobName" :placeholder="$t('page.jobTask.form.jobName')" />
</NFormItem>
<NFormItem :label="$t('page.jobTask.jobStatus')" path="jobStatus">
<NInput v-model:value="model.jobStatus" :placeholder="$t('page.jobTask.form.jobStatus')" />
<NSelect
v-model:value="model.jobStatus"
:placeholder="$t('page.jobTask.form.jobStatus')"
:options="translateOptions(enableStatusNumberOptions)"
/>
</NFormItem>
</NForm>
<template #footer>

View File

@ -33,7 +33,7 @@ function search() {
<NInput v-model:value="model.jobName" :placeholder="$t('page.jobTask.form.jobName')" />
</NFormItemGi>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.jobTask.jobStatus')" path="jobStatus" class="pr-24px">
<NInput v-model:value="model.jobStatus" :placeholder="$t('page.jobTask.form.jobStatus')" />
<!-- <NInput v-model:value="model.jobStatus" :placeholder="$t('page.jobTask.form.jobStatus')" />-->
</NFormItemGi>
</SearchForm>
</template>

View File

@ -0,0 +1,174 @@
<script setup lang="tsx">
import { NButton, NPopconfirm } from 'naive-ui';
import { fetchRetryLogPageList } from '@/service/api';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import { useTable, useTableOperate } from '@/hooks/common/table';
import RetryLogSearch from './modules/retry-log-search.vue';
const appStore = useAppStore();
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchRetryLogPageList,
apiParams: {
page: 1,
size: 10,
// 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
UniqueId: null,
groupName: null,
sceneName: null,
idempotentId: null,
bizNo: null
},
columns: () => [
{
type: 'selection',
align: 'center',
width: 48
},
{
key: 'index',
title: $t('common.index'),
align: 'center',
width: 64
},
{
key: 'UniqueId',
title: $t('page.retryLog.UniqueId'),
align: 'left',
minWidth: 120
},
{
key: 'groupName',
title: $t('page.retryLog.groupName'),
align: 'left',
minWidth: 120
},
{
key: 'sceneName',
title: $t('page.retryLog.sceneName'),
align: 'left',
minWidth: 120
},
{
key: 'retryStatus',
title: $t('page.retryLog.retryStatus'),
align: 'left',
minWidth: 120
},
{
key: 'taskType',
title: $t('page.retryLog.taskType'),
align: 'left',
minWidth: 120
},
{
key: 'idempotentId',
title: $t('page.retryLog.idempotentId'),
align: 'left',
minWidth: 120
},
{
key: 'bizNo',
title: $t('page.retryLog.bizNo'),
align: 'left',
minWidth: 120
},
{
key: 'createDt',
title: $t('page.retryLog.createDt'),
align: 'left',
minWidth: 120
},
{
key: 'operate',
title: $t('common.operate'),
align: 'center',
width: 130,
render: row => (
<div class="flex-center gap-8px">
<NButton type="primary" ghost size="small" onClick={() => edit(row.id)}>
{$t('common.edit')}
</NButton>
<NPopconfirm onPositiveClick={() => handleDelete(row.id)}>
{{
default: () => $t('common.confirmDelete'),
trigger: () => (
<NButton type="error" ghost size="small">
{$t('common.delete')}
</NButton>
)
}}
</NPopconfirm>
</div>
)
}
]
});
const {
handleAdd,
handleEdit,
checkedRowKeys,
onBatchDeleted,
onDeleted
// closeDrawer
} = useTableOperate(data, getData);
async function handleBatchDelete() {
// request
console.log(checkedRowKeys.value);
onBatchDeleted();
}
function handleDelete(id: any) {
// request
console.log(id);
onDeleted();
}
function edit(id: any) {
handleEdit(id);
}
</script>
<template>
<div class="min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto">
<RetryLogSearch v-model:model="searchParams" @reset="resetSearchParams" @search="getData" />
<NCard
:title="$t('page.retryLog.title')"
:bordered="false"
size="small"
class="sm:flex-1-hidden card-wrapper"
header-class="view-card-header"
>
<template #header-extra>
<TableHeaderOperation
v-model:columns="columnChecks"
:disabled-delete="checkedRowKeys.length === 0"
:loading="loading"
@add="handleAdd"
@delete="handleBatchDelete"
@refresh="getData"
/>
</template>
<NDataTable
v-model:checked-row-keys="checkedRowKeys"
:columns="columns"
:data="data"
:flex-height="!appStore.isMobile"
:scroll-x="962"
:loading="loading"
remote
:row-key="row => row.id"
:pagination="mobilePagination"
class="sm:h-full"
/>
</NCard>
</div>
</template>
<style scoped></style>

View File

@ -0,0 +1,46 @@
<script setup lang="ts">
import { $t } from '@/locales';
defineOptions({
name: 'RetryLogSearch'
});
interface Emits {
(e: 'reset'): void;
(e: 'search'): void;
}
const emit = defineEmits<Emits>();
const model = defineModel<Api.RetryLog.RetryLogSearchParams>('model', { required: true });
function reset() {
emit('reset');
}
function search() {
emit('search');
}
</script>
<template>
<SearchForm :model="model" @search="search" @reset="reset">
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.groupName')" path="groupName" class="pr-24px">
<NInput v-model:value="model.groupName" :placeholder="$t('page.retryLog.form.groupName')" />
</NFormItemGi>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.sceneName')" path="sceneName" class="pr-24px">
<NInput v-model:value="model.sceneName" :placeholder="$t('page.retryLog.form.sceneName')" />
</NFormItemGi>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.UniqueId')" path="UniqueId" class="pr-24px">
<NInput v-model:value="model.UniqueId" :placeholder="$t('page.retryLog.form.UniqueId')" />
</NFormItemGi>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.idempotentId')" path="idempotentId" class="pr-24px">
<NInput v-model:value="model.idempotentId" :placeholder="$t('page.retryLog.form.idempotentId')" />
</NFormItemGi>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.bizNo')" path="bizNo" class="pr-24px">
<NInput v-model:value="model.bizNo" :placeholder="$t('page.retryLog.form.bizNo')" />
</NFormItemGi>
</SearchForm>
</template>
<style scoped></style>

View File

@ -2,6 +2,7 @@
import { ref } from 'vue';
import { $t } from '@/locales';
import SelectGroup from '@/components/common/select-group.vue';
import TaskBatchStatus from '@/components/common/task-batch-status.vue';
import { fetchGetWorkflowNameList } from '@/service/api';
@ -56,7 +57,7 @@ async function groupNameUpdate(groupName: string) {
path="taskBatchStatus"
class="pr-24px"
>
<NInput v-model:value="model.taskBatchStatus" :placeholder="$t('page.workflowBatch.form.taskBatchStatus')" />
<TaskBatchStatus v-model:value="model.taskBatchStatus" />
</NFormItemGi>
</SearchForm>
</template>