feat(sj_1.0.0): 通过客户端生成幂等ID
This commit is contained in:
parent
f37697c899
commit
6c81cb75db
@ -62,3 +62,12 @@ export function fetchBatchDeleteRetryTask(data: Api.RetryTask.BatchDeleteRetryTa
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
/** generate retryTask idempotent id */
|
||||
export function fetchIdempotentIdGenerate(data: Api.RetryTask.GenerateRetryIdempotentIdVO) {
|
||||
return request<string>({
|
||||
url: '/retry-task/generate/idempotent-id',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
11
src/typings/api.d.ts
vendored
11
src/typings/api.d.ts
vendored
@ -679,6 +679,17 @@ declare namespace Api {
|
||||
ids: string[];
|
||||
};
|
||||
|
||||
type GenerateRetryIdempotentIdVO = {
|
||||
/** 组名称 */
|
||||
groupName: string;
|
||||
/** 场景名称 */
|
||||
sceneName: string;
|
||||
/** 执行参数 */
|
||||
argsStr: string;
|
||||
/** 执行器名称 */
|
||||
executorName: string;
|
||||
};
|
||||
|
||||
/** RetryTask search params */
|
||||
type RetryTaskSearchParams = CommonType.RecordNullable<
|
||||
Pick<Api.RetryTask.RetryTask, 'uniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo' | 'retryStatus'> &
|
||||
|
@ -129,9 +129,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
width: 260,
|
||||
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.groupName!, row.id!)}>
|
||||
{{
|
||||
default: () => $t('common.confirmDelete'),
|
||||
@ -211,9 +208,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
const {
|
||||
drawerVisible,
|
||||
operateType,
|
||||
editingData,
|
||||
handleAdd,
|
||||
handleEdit,
|
||||
checkedRowKeys,
|
||||
onBatchDeleted,
|
||||
onDeleted
|
||||
@ -239,10 +234,6 @@ async function handleBatchDelete() {
|
||||
onBatchDeleted();
|
||||
}
|
||||
|
||||
function edit(id: string) {
|
||||
handleEdit(id);
|
||||
}
|
||||
|
||||
function handleBatchAdd() {
|
||||
openBatchAddDrawer();
|
||||
}
|
||||
@ -304,13 +295,8 @@ async function updateRetryTaskStatus(id: number, groupName: string, retryStatus:
|
||||
:pagination="mobilePagination"
|
||||
class="sm:h-full"
|
||||
/>
|
||||
<RetryTaskOperateDrawer
|
||||
v-model:visible="drawerVisible"
|
||||
:operate-type="operateType"
|
||||
:row-data="editingData"
|
||||
@submitted="getData"
|
||||
/>
|
||||
<RetryTaskBatchAddDrawer v-model:visible="batchAddDrawerVisible" :row-data="editingData" @submitted="getData" />
|
||||
<RetryTaskOperateDrawer v-model:visible="drawerVisible" :operate-type="operateType" @submitted="getData" />
|
||||
<RetryTaskBatchAddDrawer v-model:visible="batchAddDrawerVisible" @submitted="getData" />
|
||||
</NCard>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -3,7 +3,12 @@ import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||
import { $t } from '@/locales';
|
||||
import { fetchAddRetryTask, fetchGetAllGroupNameList, fetchGetRetrySceneList } from '@/service/api';
|
||||
import {
|
||||
fetchAddRetryTask,
|
||||
fetchGetAllGroupNameList,
|
||||
fetchGetRetrySceneList,
|
||||
fetchIdempotentIdGenerate
|
||||
} from '@/service/api';
|
||||
import { translateOptions, translateOptions2 } from '@/utils/common';
|
||||
import { retryTaskStatusTypeOptions } from '@/constants/business';
|
||||
|
||||
@ -113,12 +118,6 @@ async function handleSubmit() {
|
||||
window.$message?.success($t('common.addSuccess'));
|
||||
}
|
||||
|
||||
// if (props.operateType === 'edit') {
|
||||
// const { ... } = model;
|
||||
// fetchEditRetryTask({ ... });
|
||||
// window.$message?.success($t('common.updateSuccess'));
|
||||
// }
|
||||
|
||||
closeDrawer();
|
||||
emit('submitted');
|
||||
}
|
||||
@ -145,8 +144,20 @@ async function handleGroupNameUpdate(groupName: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function setIdempotentId() {
|
||||
model.idempotentId = 'test';
|
||||
async function setIdempotentId() {
|
||||
const groupName = model.groupName;
|
||||
const sceneName = model.sceneName;
|
||||
const executorName = model.executorName;
|
||||
const argsStr = model.argsStr;
|
||||
const { data: idempotentId, error } = await fetchIdempotentIdGenerate({
|
||||
groupName,
|
||||
sceneName,
|
||||
executorName,
|
||||
argsStr
|
||||
});
|
||||
if (!error) {
|
||||
model.idempotentId = idempotentId;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
@ -61,8 +61,8 @@ onMounted(() => {
|
||||
v-model:value="model.groupName"
|
||||
:placeholder="$t('page.retryTask.form.groupName')"
|
||||
:options="translateOptions2(groupNameList)"
|
||||
filterable
|
||||
clearable
|
||||
filterable
|
||||
@update:value="handleGroupNameUpdate"
|
||||
/>
|
||||
</NFormItemGi>
|
||||
|
Loading…
Reference in New Issue
Block a user