|
|
@@ -1,421 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="app-container" style="background-color: #F7F7F7;height: 100%;overflow: auto;">
|
|
|
- <div class="gw-statistic-row" style="height: 12vh;">
|
|
|
- <gw-statistic v-for="item in statisticData" :key="item.name" :name="item.name" :value="item.value"
|
|
|
- :color="item.color"></gw-statistic>
|
|
|
- </div>
|
|
|
- <div class="gw-statistic-row" style="height: 30vh;">
|
|
|
- <gw-card style="width: 50%;">
|
|
|
- <template v-slot:title>
|
|
|
- <span>模型服务接口统计</span>
|
|
|
- </template>
|
|
|
- <gw-echart ref="top9Ref"></gw-echart>
|
|
|
- </gw-card>
|
|
|
- <!-- <gw-card style="width: 33%;">-->
|
|
|
- <!-- <template v-slot:title>-->
|
|
|
- <!-- <span>模型计算结果统计</span>-->
|
|
|
- <!-- </template>-->
|
|
|
- <!-- <gw-echart ref="top10Ref"></gw-echart>-->
|
|
|
- <!-- </gw-card>-->
|
|
|
- <gw-card style="width: 50%;">
|
|
|
- <template v-slot:title>
|
|
|
- <div style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
- <div>
|
|
|
- <span>模型计算成功统计</span>
|
|
|
- </div>
|
|
|
- <el-segmented v-model="dateType" :options="dateTypeOptions" @change="initChartTop11"/>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <gw-echart ref="top11Ref"></gw-echart>
|
|
|
- </gw-card>
|
|
|
- </div>
|
|
|
- <div class="gw-statistic-row" style="height: 30vh;">
|
|
|
- <gw-card style="width: 50%;">
|
|
|
- <template v-slot:title>
|
|
|
- <div style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
- <div>模型调用次数</div>
|
|
|
- <el-segmented v-model="dateType" :options="dateTypeOptions" @change="initChartTop3"/>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <gw-echart ref="top3Ref"></gw-echart>
|
|
|
- </gw-card>
|
|
|
- <gw-card style="width: 50%;">
|
|
|
- <template v-slot:title>
|
|
|
- <div style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
- <div>
|
|
|
- <span>应用调用统计</span>
|
|
|
- <span style="color: #79bbff;"> {{ todayModelCallCount }} </span>
|
|
|
- <span>次</span>
|
|
|
- </div>
|
|
|
- <el-segmented v-model="dateType" :options="dateTypeOptions" @change="initChartTop1"/>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- <gw-echart ref="top1Ref"></gw-echart>
|
|
|
- </gw-card>
|
|
|
- <!-- <gw-card style="width: 30%;">-->
|
|
|
- <!-- <template v-slot:title>-->
|
|
|
- <!-- <div style="display: flex;align-items: center;font-weight: bold;width: 100%;">-->
|
|
|
- <!-- <div style="">模型服务调用次数</div>-->
|
|
|
- <!-- <div style="width: 50%;margin-left: 20%;">-->
|
|
|
- <!-- <el-select v-model="userId" class="m-2" placeholder="选则用户" style="width: 100%;"-->
|
|
|
- <!-- @change="initChartTop2">-->
|
|
|
- <!-- <el-option v-for="item in userOptions" :key="item.value" :label="item.label" :value="item.value"/>-->
|
|
|
- <!-- </el-select>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </div>-->
|
|
|
- <!-- </template>-->
|
|
|
- <!-- <gw-echart ref="top2Ref"></gw-echart>-->
|
|
|
- <!-- </gw-card>-->
|
|
|
- </div>
|
|
|
-
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-<script setup>
|
|
|
-import {onMounted} from 'vue';
|
|
|
-import * as echarts from 'echarts';
|
|
|
-import GwStatistic from "@/views/monitor/service/GwStatistic.vue";
|
|
|
-import {
|
|
|
- getModelCallCount,
|
|
|
- getModelServiceCount,
|
|
|
- getModelServiceSuccessCount,
|
|
|
- getModelTypeCallCount,
|
|
|
- getStatisticData,
|
|
|
- getUserModelCallCount,
|
|
|
- getViewNumByCity
|
|
|
-} from "@/api/monitor/server.js";
|
|
|
-import {initEchartMap} from "@/utils/echarts/chinaMap.js";
|
|
|
-import GwCard from "@/views/monitor/service/GwCard.vue";
|
|
|
-import GwEchart from "@/components/chart/GwEchart.vue";
|
|
|
-import {listUser} from "@/api/system/user.js";
|
|
|
-import {parseTime} from "@/utils/ruoyi.js";
|
|
|
-import {getAlarmList} from "@/api/service/alarm.js";
|
|
|
-
|
|
|
-const statisticData = ref([
|
|
|
- {name: '当前服务总数', value: 0, color: '#477ACF'},
|
|
|
- {name: '服务在线比率', value: '0%', color: '#40B0D7'},
|
|
|
- {name: '模型服务支撑健康指数', value: '无', color: '#2DBEA2'},
|
|
|
- {name: '当月热点服务', value: '无', color: '#487ACF'},
|
|
|
- {name: '累计调用次数', value: '0', color: '#4BBA9B'},
|
|
|
-])
|
|
|
-const todayModelCallCount = ref(0)
|
|
|
-const userId = ref(null)
|
|
|
-const userOptions = ref([])
|
|
|
-listUser().then(res => {
|
|
|
- userOptions.value = res.rows.map(item => {
|
|
|
- return {
|
|
|
- label: item.nickName,
|
|
|
- value: item.userId
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-})
|
|
|
-const top1Ref = ref(null)
|
|
|
-const top2Ref = ref(null)
|
|
|
-const top3Ref = ref(null)
|
|
|
-const top5Ref = ref(null)
|
|
|
-const top9Ref = ref(null)
|
|
|
-const top11Ref = ref(null)
|
|
|
-const modelTypeCallCount = ref(0)
|
|
|
-
|
|
|
-const dateType = ref('5')
|
|
|
-const dateTypeOptions = ref([
|
|
|
- {label: '今日', value: '1'},
|
|
|
- {label: '近三日', value: '2'},
|
|
|
- {label: '近一周', value: '3'},
|
|
|
- {label: '近一个月', value: '4'},
|
|
|
- {label: '全部', value: '5'},
|
|
|
-])
|
|
|
-const bt1Ref = ref(null)
|
|
|
-const echartMapData = ref([])
|
|
|
-const alarmTableData = ref([
|
|
|
- {tm: '09-12 11:12', type: '格式异常', modelName: '上海沿海风暴潮预报模型', content: '调用返回异常'},
|
|
|
- {tm: '09-11 11:12', type: '请求异常', modelName: '上海沿海风暴潮预报模型', content: '模型连接失败'},
|
|
|
- {tm: '09-10 11:12', type: '服务器未响应', modelName: '上海沿海风暴潮预报模型', content: '服务器报错'},
|
|
|
-])
|
|
|
-
|
|
|
-function getTimes(dateType) {
|
|
|
- let startTime = null, endTime = null
|
|
|
- const date = new Date()
|
|
|
- switch (dateType) {
|
|
|
- case '1':
|
|
|
- startTime = parseTime(new Date(), '{y}-{m}-{d}') + ' 00:00:00'
|
|
|
- date.setDate(date.getDate() + 1)
|
|
|
- endTime = parseTime(date, '{y}-{m}-{d}') + ' 00:00:00'
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- endTime = parseTime(new Date())
|
|
|
- date.setDate(date.getDate() - 3)
|
|
|
- startTime = parseTime(date)
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- endTime = parseTime(new Date())
|
|
|
- date.setDate(date.getDate() - 7)
|
|
|
- startTime = parseTime(date)
|
|
|
- break;
|
|
|
- case '4':
|
|
|
- endTime = parseTime(new Date())
|
|
|
- date.setDate(date.getDate() - 30)
|
|
|
- startTime = parseTime(date)
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- return {startTime, endTime}
|
|
|
-}
|
|
|
-
|
|
|
-function initChartTop1() {
|
|
|
- const params = {}
|
|
|
- const {startTime, endTime} = getTimes(dateType.value)
|
|
|
- params.startTime = startTime
|
|
|
- params.endTime = endTime
|
|
|
- getModelCallCount(params).then(res => {
|
|
|
- let chartData = res.data
|
|
|
- todayModelCallCount.value = chartData.map(item => item.total).reduce((acc, current) => acc + current, 0);
|
|
|
- const option = {
|
|
|
- tooltip: {},
|
|
|
- grid: {
|
|
|
- left: '5%',
|
|
|
- right: '5%',
|
|
|
- bottom: '0%',
|
|
|
- top: '10%',
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- // splitLine: {show: false},
|
|
|
- axisLabel: {
|
|
|
- rotate: 10 // 设置标签旋转45度
|
|
|
- },
|
|
|
- data: chartData.map(item => item.appName),
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- type: 'value',
|
|
|
- name: '次',
|
|
|
- // splitLine: {show: false}
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- data: chartData.map(item => item.total),
|
|
|
- type: 'bar',
|
|
|
- label: {
|
|
|
- show: true, // 启用标签
|
|
|
- position: 'top' // 位置:顶部(可选 'inside'、'bottom' 等)
|
|
|
- }
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- top1Ref.value.loadChart(option);
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function initChartTop3() {
|
|
|
- const params = {}
|
|
|
- const {startTime, endTime} = getTimes(dateType.value)
|
|
|
- params.startTime = startTime
|
|
|
- params.endTime = endTime
|
|
|
- getModelTypeCallCount(params).then(res => {
|
|
|
- modelTypeCallCount.value = res.data.map(item => item.total).reduce((acc, current) => acc + current, 0);
|
|
|
- let chartData = res.data.map(item => {
|
|
|
- return {
|
|
|
- name: item.name,
|
|
|
- value: item.total
|
|
|
- }
|
|
|
- })
|
|
|
- const option = {
|
|
|
- tooltip: {
|
|
|
- trigger: 'item'
|
|
|
- },
|
|
|
- grid: {
|
|
|
- left: '5%',
|
|
|
- right: '5%',
|
|
|
- bottom: '0%',
|
|
|
- top: '10%',
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- legend: {
|
|
|
- top: '90%',
|
|
|
- left: 'center'
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'pie',
|
|
|
- radius: ['50%', '70%'],
|
|
|
- avoidLabelOverlap: false,
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'outside',
|
|
|
- formatter: '{c}',
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- show: true
|
|
|
- },
|
|
|
- color: ['#529b2e', '#95d475', '#b3e19d', '#d1edc4'],
|
|
|
- data: chartData
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- top3Ref.value.loadChart(option)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function initChartTop9() {
|
|
|
- getModelServiceCount().then(res => {
|
|
|
- modelTypeCallCount.value = res.data.map(item => item.total).reduce((acc, current) => acc + current, 0);
|
|
|
- let chartData = res.data.map(item => {
|
|
|
- return {
|
|
|
- name: item.name,
|
|
|
- value: item.total
|
|
|
- }
|
|
|
- })
|
|
|
- const option = {
|
|
|
- tooltip: {
|
|
|
- trigger: 'item'
|
|
|
- },
|
|
|
- grid: {
|
|
|
- left: '5%',
|
|
|
- right: '5%',
|
|
|
- bottom: '0%',
|
|
|
- top: '10%',
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- legend: {
|
|
|
- top: '90%',
|
|
|
- left: 'center'
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'pie',
|
|
|
- radius: ['50%', '70%'],
|
|
|
- avoidLabelOverlap: false,
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- position: 'outside',
|
|
|
- formatter: '{c}',
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- show: true
|
|
|
- },
|
|
|
- color: ['#529b2e', '#95d475', '#b3e19d', '#d1edc4'],
|
|
|
- data: chartData
|
|
|
- }
|
|
|
- ]
|
|
|
- };
|
|
|
- top9Ref.value.loadChart(option)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-function initChartTop11() {
|
|
|
- const params = {}
|
|
|
- const {startTime, endTime} = getTimes(dateType.value)
|
|
|
- params.startTime = startTime
|
|
|
- params.endTime = endTime
|
|
|
- getModelServiceSuccessCount(params).then(res => {
|
|
|
- let rawData = [
|
|
|
- res.data.map(item => item.success),
|
|
|
- res.data.map(item => item.fail)
|
|
|
- ]
|
|
|
- const totalData = [];
|
|
|
- for (let i = 0; i < rawData[0].length; ++i) {
|
|
|
- let sum = 0;
|
|
|
- for (let j = 0; j < rawData.length; ++j) {
|
|
|
- sum += rawData[j][i];
|
|
|
- }
|
|
|
- totalData.push(sum);
|
|
|
- }
|
|
|
- const series = ['成功', '失败'].map((name, sid) => {
|
|
|
- return {
|
|
|
- name,
|
|
|
- type: 'bar',
|
|
|
- stack: 'total',
|
|
|
- barWidth: '60%',
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- formatter: (params) => Math.round(params.value * 1000) / 10 + '%'
|
|
|
- },
|
|
|
- data: rawData[sid].map((d, did) =>
|
|
|
- totalData[did] <= 0 ? 0 : d / totalData[did]
|
|
|
- )
|
|
|
- };
|
|
|
- });
|
|
|
- const option = {
|
|
|
- legend: {
|
|
|
- selectedMode: false
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- trigger: 'item'
|
|
|
- },
|
|
|
- grid: {
|
|
|
- left: '5%',
|
|
|
- right: '5%',
|
|
|
- bottom: '0%',
|
|
|
- top: '20%',
|
|
|
- containLabel: true
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- type: 'value'
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- type: 'category',
|
|
|
- axisLabel: {
|
|
|
- rotate: 10 // 设置标签旋转45度
|
|
|
- },
|
|
|
- data: res.data.map(item => item.name)
|
|
|
- },
|
|
|
- series
|
|
|
- };
|
|
|
- top11Ref.value.loadChart(option)
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-/** 获取统计数据 */
|
|
|
-function initStatisticData() {
|
|
|
- getStatisticData().then((r) => {
|
|
|
- statisticData.value = r.data
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- initStatisticData()
|
|
|
-
|
|
|
- initChartTop1()
|
|
|
- initChartTop3()
|
|
|
- initChartTop9()
|
|
|
- initChartTop11()
|
|
|
-});
|
|
|
-</script>
|
|
|
-<style scoped lang="scss">
|
|
|
-.boxShadow {
|
|
|
- box-shadow: -8px 0 15px -10px rgba(0, 0, 0, 0.1), /* 左侧阴影 */
|
|
|
- 8px 0 15px -10px rgba(0, 0, 0, 0.1); /* 右侧阴影 */
|
|
|
- transition: box-shadow 0.3s ease;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-.gw-statistic-row {
|
|
|
- display: flex;
|
|
|
- align-content: center;
|
|
|
- gap: 10px;
|
|
|
- margin-bottom: 10px;
|
|
|
-
|
|
|
- .gw-statistic-body {
|
|
|
- box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- border-radius: 8px;
|
|
|
- background: #fff;
|
|
|
- padding: 15px 20px;
|
|
|
-
|
|
|
- .title {
|
|
|
- font-weight: bold;
|
|
|
- margin: 0;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-.chart_container {
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-</style>
|