2024-03-28 16:22:18 +08:00
|
|
|
<script setup lang="ts">
|
2024-03-30 17:55:53 +08:00
|
|
|
import { computed, ref, watch } from 'vue';
|
2024-03-28 16:22:18 +08:00
|
|
|
import { useAppStore } from '@/store/modules/app';
|
|
|
|
import { fetchJobLine, fetchRetryLine } from '@/service/api';
|
|
|
|
import LineRetryChart from './line-retry-chart.vue';
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
name: 'RetryTab'
|
|
|
|
});
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
type?: number;
|
2024-03-30 17:55:53 +08:00
|
|
|
lineParams: Api.Dashboard.DashboardLineParams;
|
2024-03-28 16:22:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
type: 0
|
|
|
|
});
|
|
|
|
|
|
|
|
const appStore = useAppStore();
|
|
|
|
|
|
|
|
const gap = computed(() => (appStore.isMobile ? 0 : 16));
|
|
|
|
|
|
|
|
const data = ref<Api.Dashboard.DashboardLine>();
|
|
|
|
|
|
|
|
const getData = async () => {
|
2024-03-30 17:55:53 +08:00
|
|
|
const { data: lineData, error } =
|
|
|
|
props.type === 1 ? await fetchJobLine(props.lineParams) : await fetchRetryLine(props.lineParams);
|
2024-03-28 16:22:18 +08:00
|
|
|
|
|
|
|
if (!error) {
|
|
|
|
data.value = lineData;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-03-30 17:55:53 +08:00
|
|
|
watch(props.lineParams, () => {
|
|
|
|
getData();
|
|
|
|
});
|
|
|
|
|
2024-03-28 16:22:18 +08:00
|
|
|
getData();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
|
|
|
|
<NGi span="24 s:24 m:16">
|
2024-03-30 17:55:53 +08:00
|
|
|
<LineRetryChart v-model="data!" :type="type"></LineRetryChart>
|
2024-03-28 16:22:18 +08:00
|
|
|
</NGi>
|
|
|
|
<NGi span="24 s:24 m:8">
|
|
|
|
<div>任务量排名</div>
|
|
|
|
</NGi>
|
|
|
|
</NGrid>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped></style>
|