feat: 首页tab默认显示Job

This commit is contained in:
dhb52 2024-05-22 14:19:16 +08:00
parent 9996e16e16
commit b905629599
2 changed files with 39 additions and 39 deletions

View File

@ -91,6 +91,35 @@ interface CardData {
// eslint-disable-next-line complexity // eslint-disable-next-line complexity
const cardData = computed<CardData[]>(() => [ const cardData = computed<CardData[]>(() => [
{
key: 'jobTask',
title: $t('page.home.jobTask'),
tip: $t('page.home.jobTaskTip'),
value: props.modelValue?.jobTask.totalNum ?? 0,
color: {
start: '#f5b386',
end: '#FFD6BA'
},
icon: 'ant-design:profile-outlined',
bottom: [
{
label: $t('common.success'),
value: props.modelValue?.jobTask.successNum ?? 0
},
{
label: $t('common.fail'),
value: props.modelValue?.jobTask.failNum ?? 0
},
{
label: $t('common.stop'),
value: props.modelValue?.jobTask.stopNum ?? 0
},
{
label: $t('common.cancel'),
value: props.modelValue?.jobTask.cancelNum ?? 0
}
]
},
{ {
key: 'retryTask', key: 'retryTask',
title: $t('page.home.retryTask'), title: $t('page.home.retryTask'),
@ -121,35 +150,6 @@ const cardData = computed<CardData[]>(() => [
} }
] ]
}, },
{
key: 'jobTask',
title: $t('page.home.jobTask'),
tip: $t('page.home.jobTaskTip'),
value: props.modelValue?.jobTask.totalNum ?? 0,
color: {
start: '#f5b386',
end: '#FFD6BA'
},
icon: 'ant-design:profile-outlined',
bottom: [
{
label: $t('common.success'),
value: props.modelValue?.jobTask.successNum ?? 0
},
{
label: $t('common.fail'),
value: props.modelValue?.jobTask.failNum ?? 0
},
{
label: $t('common.stop'),
value: props.modelValue?.jobTask.stopNum ?? 0
},
{
label: $t('common.cancel'),
value: props.modelValue?.jobTask.cancelNum ?? 0
}
]
},
{ {
key: 'workflow', key: 'workflow',
title: $t('page.home.workflow'), title: $t('page.home.workflow'),

View File

@ -17,7 +17,7 @@ interface Props {
defineProps<Props>(); defineProps<Props>();
const type = ref(0); const type = ref(1);
const appStore = useAppStore(); const appStore = useAppStore();
const gap = computed(() => (appStore.isMobile ? 0 : 16)); const gap = computed(() => (appStore.isMobile ? 0 : 16));
const data = ref<Api.Dashboard.DashboardLine>(); const data = ref<Api.Dashboard.DashboardLine>();
@ -25,7 +25,8 @@ const groupOptions = ref();
const tabParams = ref<Api.Dashboard.DashboardLineParams>({ const tabParams = ref<Api.Dashboard.DashboardLineParams>({
type: 'WEEK', type: 'WEEK',
page: 1, page: 1,
size: 6 size: 6,
mode: 'JOB'
}); });
const dateRange = ref<[number, number] | null>(); const dateRange = ref<[number, number] | null>();
const formattedValue = ref<[string, string] | null>( const formattedValue = ref<[string, string] | null>(
@ -41,8 +42,6 @@ const getData = async () => {
} }
}; };
getData();
const getGroupNames = async () => { const getGroupNames = async () => {
const { data: groupNames, error } = await fetchAllGroupName(); const { data: groupNames, error } = await fetchAllGroupName();
@ -53,8 +52,6 @@ const getGroupNames = async () => {
} }
}; };
getGroupNames();
watch( watch(
() => tabParams.value, () => tabParams.value,
() => { () => {
@ -108,14 +105,14 @@ const pagination = ref({
}); });
const createPanels = () => [ const createPanels = () => [
{
name: 'retryTask',
tab: $t('page.home.retryTask')
},
{ {
name: 'jobTask', name: 'jobTask',
tab: $t('page.home.jobTask') tab: $t('page.home.jobTask')
}, },
{
name: 'retryTask',
tab: $t('page.home.retryTask')
},
{ {
name: 'workflow', name: 'workflow',
tab: $t('page.home.workflow') tab: $t('page.home.workflow')
@ -152,6 +149,9 @@ watch(
columns.value = createColumns(); columns.value = createColumns();
} }
); );
getData();
getGroupNames();
</script> </script>
<template> <template>