소스 검색

fix: 测流成果修改

hum 1 년 전
부모
커밋
c91528f2d6

+ 1 - 0
ruoyi-ui/src/assets/styles/hum.scss

@@ -37,6 +37,7 @@
   background: #fff;
   border-radius: 4px;
   padding: 20px;
+  overflow-y: auto;
 }
 
 .hum-page-search {

+ 1 - 1
ruoyi-ui/src/views/analysis/task/index.vue

@@ -36,7 +36,7 @@
             <span>{{ ['移动测流', '固定测流'][scope.row.type] }}</span>
           </template>
         </el-table-column>
-        <el-table-column label="策略名称" prop="planid" />
+        <el-table-column label="策略编号" prop="planid" />
         <el-table-column label="起测时间">
           <template slot-scope="scope">
             <span>{{ formatDateTime(scope.row.createTime) }}</span>

+ 6 - 1
ruoyi-ui/src/views/analysis/task/realtime.vue

@@ -1,14 +1,19 @@
 <template>
-  <Realtime v-if="task.taskid" :task="task" @refresh="loadTask" />
+  <div v-if="task.taskid">
+    <Realtime v-if="task.status === 0" :task="task" @refresh="loadTask" />
+    <Result v-if="task.status === 2" :task="task" @refresh="loadTask" />
+  </div>
 </template>
 
 <script>
 import {getAchievement, getLatestTask} from '@/api/analysis/achievement';
 import Realtime from './realtime/realtime';
+import Result from './result/result';
 
 export default {
   components: {
     Realtime,
+    Result,
   },
   data() {
     return {

+ 40 - 12
ruoyi-ui/src/views/analysis/task/realtime/simulation.vue

@@ -27,7 +27,6 @@
 
 <script>
 import * as echarts from "echarts";
-require('echarts/theme/macarons') // echarts theme
 import resize from '@/utils/resize'
 import { getConfig } from '@/api/site/site'
 import { getSiteSection } from '@/api/site/berthing'
@@ -97,7 +96,7 @@ export default {
     },
     loadCarLocation() {
       getCarLocation(this.siteId).then((res) => {
-        this.location = res.data?.position || 0;
+        this.location = res.data?.[0].position || 0;
         this.setOptions();
       })
     },
@@ -126,25 +125,18 @@ export default {
 
       const carWidth = 50; // 小车宽度
       const carHeight = 32; // 小车高度
-      const gap = carWidth / 2; // 断面左右留的边距,方便绘制立柱
       const barWidth = 18; // 立柱宽度
+      const boxWidth = carWidth * 1.2; // 小车充电盒子宽度
 
       const waterlevel = this.waterlevel;
       const start = this.config.offset;
       const location = this.location;
 
-      const sections = [
-        [this.sections[0].x - gap, this.sections[0].y],
-        ...this.sections.map(({x, y}) => [x, y]),
-        [this.sections[this.sections.length - 1].x + gap, this.sections[this.sections.length - 1].y],
-      ];
+      const { sections, bar1X, bar2X } = this.calcSection();
 
       const x = sections.map(([x]) => x);
       const maxX = Math.max(...x);
       const minX = Math.min(...x);
-      const bar1X = start - (carWidth - barWidth) / 2; // 左侧立柱x坐标
-      const bar2X = maxX - (start - minX) + (carWidth - barWidth) / 2; // 右侧立柱x坐标
-      const boxWidth = (carWidth - barWidth) * 2; // 小车充电盒子宽度
 
       const y = sections.map(([,y]) => y);
       const maxY = Math.max(...y);
@@ -259,7 +251,7 @@ export default {
             barWidth: barWidth,
             z: 3,
             itemStyle: {
-              color: '#A6B7C7'
+              color: '#A6B7C7',
             }
           },
           {
@@ -291,6 +283,42 @@ export default {
       };
       this.chart.setOption(options);
     },
+    calcSection() {
+      const { local, offset } = this.config;
+      const sections = [...this.sections.map(({x, y}) => [x, y])];
+      const firstPoint = this.sections[0];
+      const lastPoint = this.sections[this.sections.length - 1];
+      let bar1X = 0;
+      let bar2X = 0;
+
+      if (local === 1) {
+        bar1X = offset
+        bar2X = lastPoint.x + (firstPoint.x - offset)
+        if (offset < firstPoint.x) {
+          sections.unshift([offset, firstPoint.y])
+          sections.push([bar2X, lastPoint.y])
+        }
+      } else {
+        bar1X = firstPoint.x - (offset - lastPoint.x)
+        bar2X = offset
+        if (offset > lastPoint.x) {
+          sections.unshift([bar1X, firstPoint.y])
+          sections.push([offset, lastPoint.y])
+        }
+      }
+
+      const x = sections.map(([x]) => x);
+      const min = Math.min(...x);
+      const max = Math.max(...x);
+
+      const width = max - min;
+      const gap = width * 0.05;
+
+      sections.unshift([min - gap, firstPoint.y]);
+      sections.push([max + gap, lastPoint.y]);
+
+      return { sections, bar1X, bar2X };
+    }
   }
 }
 </script>

+ 13 - 0
ruoyi-ui/src/views/analysis/task/result/result.vue

@@ -0,0 +1,13 @@
+<template>
+  <div>111</div>
+</template>
+
+<script>
+export default {
+  name: "result"
+}
+</script>
+
+<style scoped>
+
+</style>

+ 5 - 0
ruoyi-ui/src/views/analysis/water-flow/chart.vue

@@ -48,6 +48,8 @@ export default {
         const min = Math.min(...flows);
         const seriesData = chartData.map(({ flowsum, waterlevel }) => [waterlevel, flowsum]);
 
+        console.log(seriesData)
+
         this.chart.setOption({
           xAxis: {
             name: '水位(m)',
@@ -90,6 +92,9 @@ export default {
             type: 'scatter',
             data: seriesData,
             symbolSize: (value) => {
+              if (max === min) {
+                return 10;
+              }
               const per = (value[1] - min) / (max - min);
               return 10 + 10 * per;
             },

+ 1 - 1
ruoyi-ui/src/views/analysis/water-flow/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="hum-page-container">
-    <div class="hum-page-title">水位时间</div>
+    <div class="hum-page-title">水位流量</div>
     <div class="hum-page-section hum-page-section-search">
       <div class="hum-page-search">
         <el-form :model="queryParams" size="large" ref="queryForm" label-position="top">

+ 8 - 0
ruoyi-ui/src/views/analysis/water-flow/table.vue

@@ -4,6 +4,11 @@
       <el-table-column label="瞬时总流量" prop="flowsum" />
       <el-table-column label="水位" prop="waterlevel" />
       <el-table-column label="测流时间" prop="createTime" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="goRealTime(scope.row)">测流成果</el-button>
+        </template>
+      </el-table-column>
     </el-table>
   </div>
 </template>
@@ -47,6 +52,9 @@ export default {
         }
       );
     },
+    goRealTime(task) {
+      this.$router.push(`/analysis/task/realtime/${task.siteId}?taskid=${task.taskid}`);
+    },
   }
 }
 </script>