feat(sj_1.0.0_beta4): 首页卡片新增点击动作

This commit is contained in:
xlsea 2024-06-05 10:59:03 +08:00
parent d69aef0412
commit 06eefdd117
8 changed files with 59 additions and 27 deletions

View File

@ -21,7 +21,7 @@ export function useRouterPush(inSetup = true) {
interface RouterPushOptions {
query?: Record<string, string>;
params?: Record<string, string>;
state?: Record<string, string>;
state?: Record<string, string | number>;
}
async function routerPushByKey(key: RouteKey, options?: RouterPushOptions) {

View File

@ -1162,7 +1162,7 @@ declare namespace Api {
/** retryLog search params */
type RetryLogSearchParams = CommonType.RecordNullable<
Pick<Api.RetryLog.RetryLog, 'uniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo'> &
Pick<Api.RetryLog.RetryLog, 'uniqueId' | 'groupName' | 'sceneName' | 'idempotentId' | 'bizNo' | 'retryStatus'> &
CommonSearchParams
>;

View File

@ -108,22 +108,22 @@ const cardData = computed<CardData[]>(() => [
{
label: $t('common.success'),
value: props.modelValue?.jobTask.successNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '3' } })
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: 3 } })
},
{
label: $t('common.fail'),
value: props.modelValue?.jobTask.failNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '4' } })
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: 4 } })
},
{
label: $t('common.stop'),
value: props.modelValue?.jobTask.stopNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '5' } })
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: 5 } })
},
{
label: $t('common.cancel'),
value: props.modelValue?.jobTask.cancelNum ?? 0,
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: '6' } })
click: () => routerPushByKey('job_batch', { state: { taskBatchStatus: 6 } })
}
]
},
@ -142,19 +142,23 @@ const cardData = computed<CardData[]>(() => [
bottom: [
{
label: $t('common.success'),
value: props.modelValue?.retryTask.finishNum ?? 0
value: props.modelValue?.retryTask.finishNum ?? 0,
click: () => routerPushByKey('retry_log', { state: { retryStatus: 1 } })
},
{
label: $t('common.running'),
value: props.modelValue?.retryTask.runningNum ?? 0
value: props.modelValue?.retryTask.runningNum ?? 0,
click: () => routerPushByKey('retry_log', { state: { retryStatus: 0 } })
},
{
label: $t('page.manage.retryTask.status.maxRetryTimes'),
value: props.modelValue?.retryTask.maxCountNum ?? 0
value: props.modelValue?.retryTask.maxCountNum ?? 0,
click: () => routerPushByKey('retry_log', { state: { retryStatus: 2 } })
},
{
label: $t('page.manage.retryTask.status.pauseRetry'),
value: props.modelValue?.retryTask.suspendNum ?? 0
value: props.modelValue?.retryTask.suspendNum ?? 0,
click: () => routerPushByKey('retry_log', { state: { retryStatus: 3 } })
}
]
},
@ -173,19 +177,23 @@ const cardData = computed<CardData[]>(() => [
bottom: [
{
label: $t('common.success'),
value: props.modelValue?.workFlowTask.successNum ?? 0
value: props.modelValue?.workFlowTask.successNum ?? 0,
click: () => routerPushByKey('workflow_batch', { state: { taskBatchStatus: 3 } })
},
{
label: $t('common.fail'),
value: props.modelValue?.workFlowTask.failNum ?? 0
value: props.modelValue?.workFlowTask.failNum ?? 0,
click: () => routerPushByKey('workflow_batch', { state: { taskBatchStatus: 4 } })
},
{
label: $t('common.stop'),
value: props.modelValue?.workFlowTask.stopNum ?? 0
value: props.modelValue?.workFlowTask.stopNum ?? 0,
click: () => routerPushByKey('workflow_batch', { state: { taskBatchStatus: 5 } })
},
{
label: $t('common.cancel'),
value: props.modelValue?.workFlowTask.cancelNum ?? 0
value: props.modelValue?.workFlowTask.cancelNum ?? 0,
click: () => routerPushByKey('workflow_batch', { state: { taskBatchStatus: 6 } })
}
]
},
@ -204,11 +212,13 @@ const cardData = computed<CardData[]>(() => [
bottom: [
{
label: $t('page.manage.machine.type.client'),
value: props.modelValue?.onLineService.clientTotal ?? 0
value: props.modelValue?.onLineService.clientTotal ?? 0,
click: () => routerPushByKey('pods')
},
{
label: $t('page.manage.machine.type.server'),
value: props.modelValue?.onLineService.serverTotal ?? 0
value: props.modelValue?.onLineService.serverTotal ?? 0,
click: () => routerPushByKey('pods')
}
]
}
@ -283,9 +293,9 @@ function getGradientColor(color: CardData['color']) {
<NDivider />
<template v-for="(bottomItem, bottomIndex) in item.bottom" :key="bottomIndex">
<NDivider v-if="bottomIndex !== 0" vertical />
<span :class="bottomItem.click ? 'cursor-pointer' : null" @click="bottomItem.click">
<span :class="bottomItem.click ? 'cursor-pointer home-card-footer' : null" @click="bottomItem.click">
{{ bottomItem.label }}
<CountTo :start-value="0" :end-value="bottomItem.value" class="text-white" />
<CountTo :start-value="0" :end-value="bottomItem.value" />
</span>
</template>
</GradientBg>
@ -317,4 +327,15 @@ function getGradientColor(color: CardData['color']) {
box-shadow: var(--n-box-shadow);
border-radius: 8px;
}
.home-card-footer:hover {
color: #fff;
font-size: 14px;
transition: all 0.25s ease-in;
}
.home-card-footer:hover {
color: #1366ff !important;
font-size: 15px;
}
</style>

View File

@ -20,6 +20,8 @@ const detailData = ref<Api.JobBatch.JobBatch | null>();
/** 详情页可见状态 */
const { bool: detailVisible, setTrue: openDetail } = useBoolean(false);
const taskBatchStatus = history.state.taskBatchStatus;
const { columnChecks, columns, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchGetJobBatchList,
apiParams: {
@ -27,7 +29,7 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP
size: 10,
groupName: null,
jobName: null,
taskBatchStatus: null
taskBatchStatus
},
columns: () => [
{

View File

@ -23,12 +23,6 @@ function reset() {
function search() {
emit('search');
}
const taskBatchStatus = history.state.taskBatchStatus;
if (taskBatchStatus) {
model.value.taskBatchStatus = Number(taskBatchStatus) as Api.Common.TaskBatchStatus;
}
</script>
<template>

View File

@ -18,6 +18,8 @@ const detailData = ref<Api.RetryLog.RetryLog | null>();
/** 详情页可见状态 */
const { bool: detailVisible, setTrue: openDetail } = useBoolean(false);
const retryStatus = history.state.retryStatus;
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchRetryLogPageList,
apiParams: {
@ -29,7 +31,8 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
groupName: null,
sceneName: null,
idempotentId: null,
bizNo: null
bizNo: null,
retryStatus
},
columns: () => [
{

View File

@ -1,5 +1,7 @@
<script setup lang="ts">
import { $t } from '@/locales';
import { translateOptions } from '@/utils/common';
import { retryTaskStatusTypeOptions } from '@/constants/business';
import SelectGroup from '@/components/common/select-group.vue';
import SelectScene from '@/components/common/select-scene.vue';
@ -42,6 +44,14 @@ function search() {
<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>
<NFormItemGi span="24 s:12 m:6" :label="$t('page.retryLog.retryStatus')" path="taskBatchStatus" class="pr-24px">
<NSelect
v-model:value="model.retryStatus"
:placeholder="$t('page.retryTask.form.retryStatus')"
:options="translateOptions(retryTaskStatusTypeOptions)"
clearable
/>
</NFormItemGi>
</SearchForm>
</template>

View File

@ -16,6 +16,8 @@ const workflowId =
const appStore = useAppStore();
const taskBatchStatus = history.state.taskBatchStatus;
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
apiFn: fetchGetWorkflowBatchList,
apiParams: {
@ -25,7 +27,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
// the value can not be undefined, otherwise the property in Form will not be reactive
workflowId,
groupName: null,
taskBatchStatus: null
taskBatchStatus
},
columns: () => [
{