chroe: add view error logs redirect

This commit is contained in:
engigu
2024-01-25 15:08:00 +08:00
parent 459b28e173
commit d341a7e157
5 changed files with 66 additions and 15 deletions
@@ -134,14 +134,13 @@ export default {
}
}
const filterFunc = async () => {
await queryListData(state.currPage, state.pageSize, state.search, state.optionValue);
}
const queryListData = async (page, size, name = '', taskid = '') => {
let params = { page: page, size: size, name: name, taskid: taskid };
const queryListData = async (page, size, name = '', taskid = '', query = '') => {
let params = { page: page, size: size, name: name, taskid: taskid, query: query };
const rsp = await request.get('/sendlogs/list', { params: params });
state.tableData = await rsp.data.data.lists;
state.total = await rsp.data.data.total;
@@ -149,7 +148,7 @@ export default {
onMounted(async () => {
state.search = router.query.name;
await queryListData(1, state.pageSize, router.query.name, router.query.taskid);
await queryListData(1, state.pageSize, router.query.name, router.query.taskid, router.query.query);
});
return {
@@ -32,6 +32,11 @@
今日发送失败数
</div>
</template>
<template #suffix>
<el-icon :size="14">
<ArrowRight v-if="data.today_failed_num > 0" @click="clickErrorNumDetail()" />
</el-icon>
</template>
</el-statistic>
</div>
@@ -42,7 +47,7 @@
<div class="echarts-box">
<div id="daily-chart" style="width: 65%; height: 350px;"></div>
<div id="send-cate-chart" style="width: 35%; height: 300px;"></div>
<div id="send-cate-chart" style="width: 35%; height: 350px;"></div>
</div>
</div>
@@ -50,17 +55,23 @@
</template>
<script >
// import {
// ArrowRight,
// CaretBottom,
// CaretTop,
// Warning,
// } from '@element-plus/icons-vue'
import { reactive, toRefs, onMounted, onUnmounted ,inject } from 'vue'
import {
ArrowRight,
CaretBottom,
CaretTop,
Warning,
} from '@element-plus/icons-vue'
import { reactive, toRefs, onMounted, onUnmounted, inject } from 'vue'
import { request } from '@/api/api'
import { useRouter } from 'vue-router';
import { CommonUtils } from "@/util/commonUtils.js";
export default {
components: {
ArrowRight,
},
setup() {
const router = useRouter();
const state = reactive({
data: {},
dailyChart: {},
@@ -77,6 +88,7 @@ export default {
}
}
// 格式化发送失败的数字样式
const formatFailedNumStyle = () => {
let style = {};
if (state.data.today_failed_num) {
@@ -85,6 +97,13 @@ export default {
return style;
}
const clickErrorNumDetail = () => {
let query = { status: 0, day_created_on: CommonUtils.getCurrentTimeStr().slice(0, 10) };
let queryStr = encodeURIComponent(JSON.stringify(query));
router.push('/sendlogs?query=' + queryStr, { replace: true });
}
onMounted(async () => {
await getStatisticData();
formatFailedNumStyle();
@@ -179,7 +198,7 @@ export default {
}
return {
...toRefs(state), formatFailedNumStyle
...toRefs(state), formatFailedNumStyle, clickErrorNumDetail
};
}
}