Lin Qilong 1 miesiąc temu
rodzic
commit
281c5da632

+ 4 - 0
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/ServerMonitorService.java

@@ -19,6 +19,10 @@ public class ServerMonitorService {
             Optional.of(json)
                     .map(o -> JsonUtils.jsonToPojo(o, JSONObject.class))
                     .map(o -> o.getJSONObject("data"))
+                    .map(o -> {
+                        o.getJSONObject("system").put("primary_ip", server.split(":")[1].replaceAll("/", ""));
+                        return o;
+                    })
                     .ifPresent(result::add);
         }));
         return result;

+ 64 - 52
ruoyi-ui/src/views/monitor/service/index.vue

@@ -170,6 +170,7 @@ 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";
+import {snailJobLine} from "@/api/service/timing.js";
 
 const statisticData = ref([
   {name: '模型总数', value: 0, color: '#477ACF'},
@@ -207,10 +208,12 @@ const dateTypeOptions = ref([
   {label: '近一个月', value: '4'},
   {label: '全部', value: '5'},
 ])
-const task = ref('1')
+const task = ref('MONTH')
 const taskOptions = ref([
-  {label: '日执行量', value: '1'},
-  {label: '月执行量', value: '2'},
+  {label: '今日', value: 'DAY'},
+  {label: '最近一周', value: 'WEEK'},
+  {label: '最近一月', value: 'MONTH'},
+  {label: '全年', value: 'YEAR'},
 ])
 const bt1Ref = ref(null)
 const echartMapData = ref([])
@@ -589,58 +592,67 @@ function initChartBottom2() {
 }
 
 function initChartTop5() {
-  const option = {
-    legend: {},
-    grid: {
-      left: '5%',
-      right: '5%',
-      bottom: '10%',
-      top: '15%',
-      containLabel: true
-    },
-    tooltip: {
-      trigger: 'axis',
-      showContent: false
-    },
-    dataset: {
-      source: [
-        ['模型', '09-07', '09-08', '09-09', '09-10', '09-11', '09-12'],
-        ['上海沿海风暴潮预报模型', 56.5, 82.1, 88.7, 70.1, 53.4, 85.1],
-        ['马斯京根法', 51.1, 51.4, 55.1, 53.3, 73.8, 68.7],
-        ['三水源新安江产流模型', 40.1, 62.2, 69.5, 36.4, 45.2, 32.5],
-        ['上海市中心城区排水系统模型', 25.2, 37.1, 41.2, 18, 33.9, 49.1]
-      ]
-    },
-    xAxis: {type: 'category'},
-    yAxis: {gridIndex: 0},
-    series: [
-      {
-        type: 'line',
-        smooth: true,
-        seriesLayoutBy: 'row',
-        emphasis: {focus: 'series'}
+  snailJobLine({type: task.value}).then(res => {
+    const chartData = res.data
+    const option = {
+      color: ['#2dbea2', '#f56c6c', '#b686d4', '#e6a23c'],
+      legend: {},
+      grid: {
+        left: '5%',
+        right: '5%',
+        bottom: '10%',
+        top: '15%',
+        containLabel: true
       },
-      {
-        type: 'line',
-        smooth: true,
-        seriesLayoutBy: 'row',
-        emphasis: {focus: 'series'}
+      // tooltip: {
+      //   trigger: 'axis'
+      // },
+      tooltip: {
+        trigger: "item",
+        // formatter: "{a} <br/>{b} : {c}"
       },
-      {
-        type: 'line',
-        smooth: true,
-        seriesLayoutBy: 'row',
-        emphasis: {focus: 'series'}
+      xAxis: {
+        type: 'category',
+        data: chartData.map(item => item.createDt)
       },
-      {
-        type: 'line',
-        smooth: true,
-        seriesLayoutBy: 'row',
-        emphasis: {focus: 'series'}
-      }
-    ]
-  };
-  top5Ref.value.loadChart(option);
+      yAxis: {gridIndex: 0},
+      series: [
+        {
+          type: 'line',
+          name: '成功',
+          smooth: true,
+          seriesLayoutBy: 'row',
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.success)
+        },
+        {
+          type: 'line',
+          name: '失败',
+          smooth: true,
+          seriesLayoutBy: 'row',
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.failNum)
+        },
+        {
+          type: 'line',
+          name: '停止',
+          smooth: true,
+          seriesLayoutBy: 'row',
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.stop)
+        },
+        {
+          type: 'line',
+          name: '取消',
+          smooth: true,
+          seriesLayoutBy: 'row',
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.cancel)
+        }
+      ]
+    };
+    top5Ref.value.loadChart(option);
+  })
 }
 
 function initVisitNumberChart(name, data) {

+ 19 - 13
ruoyi-ui/src/views/monitor/taskMonitor/index.vue

@@ -129,44 +129,50 @@ function initChartTop5() {
         top: '15%',
         containLabel: true
       },
+      // tooltip: {
+      //   trigger: 'axis'
+      // },
       tooltip: {
-        trigger: 'axis'
+        trigger: "item",
+        // formatter: "{a} <br/>{b} : {c}"
       },
-      dataset: {
-        source: [
-          ['时间', ...chartData.map(item => item.createDt)],
-          ['成功', ...chartData.map(item => item.success)],
-          ['失败', ...chartData.map(item => item.failNum)],
-          ['停止', ...chartData.map(item => item.stop)],
-          ['取消', ...chartData.map(item => item.cancel)],
-        ]
+      xAxis: {
+        type: 'category',
+        data: chartData.map(item => item.createDt)
       },
-      xAxis: {type: 'category'},
       yAxis: {gridIndex: 0},
       series: [
         {
           type: 'line',
+          name: '成功',
           smooth: true,
           seriesLayoutBy: 'row',
           emphasis: {focus: 'series'},
+          data: chartData.map(item => item.success)
         },
         {
           type: 'line',
+          name: '失败',
           smooth: true,
           seriesLayoutBy: 'row',
-          emphasis: {focus: 'series'}
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.failNum)
         },
         {
           type: 'line',
+          name: '停止',
           smooth: true,
           seriesLayoutBy: 'row',
-          emphasis: {focus: 'series'}
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.stop)
         },
         {
           type: 'line',
+          name: '取消',
           smooth: true,
           seriesLayoutBy: 'row',
-          emphasis: {focus: 'series'}
+          emphasis: {focus: 'series'},
+          data: chartData.map(item => item.cancel)
         }
       ]
     };