liuqiao 1 年間 前
コミット
604256ffe2

+ 2 - 1
public/static/TemplateData/style.css

@@ -1,5 +1,6 @@
 body { padding: 0; margin: 0 }
-#unity-container { position: fixed; width: 100%; height: 100%; }
+/* position: fixed; */
+#unity-container { width: 100%; height: 60vh; }
 #unity-canvas { width: 100%; height: 100%; background: #231F20 }
 #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
 #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }

+ 24 - 0
src/router/index.js

@@ -4,6 +4,7 @@ import { createRouter, createWebHashHistory, } from "vue-router";
 import configurator from "@/view/configurator.vue"
 import resultLeft from '@/view/result/resultLeft.vue';
 import resultRight from '@/view/result/resultRight.vue';
+const home = () => import("@/views/home/index.vue")
 import result from '@/view/result.vue';
 const router = createRouter({
     history: createWebHashHistory(),
@@ -18,6 +19,7 @@ const router = createRouter({
             },
            
         },
+        
         // {
         //     path: '/',
         //     name:'首页',
@@ -36,8 +38,30 @@ const router = createRouter({
               keepAlive:false, // 需要缓存
               title: '主页'
           },
+          children:[
+            {
+              path: '/home',
+              name: 'home',
+              component: () => import('@/views/home/index.vue'),
+            }
+          ]
          
       },
+      // {
+      //   path: "/home",
+      //   name: "home",
+      //   component: home
+      // },
+    //   {
+    //     path: '/home',
+    //     name:'局部',
+    //     component: () => import( "@/views/home/index.vue"),
+    //     meta:{
+    //         keepAlive:false, // 需要缓存
+    //         title: '局部'
+    //     },
+       
+    // },
 
 {
     path: '/goods',

+ 11 - 1
src/style/style.css

@@ -22,7 +22,17 @@ body,html{
 .summary-dlg {
     pointer-events: none;
 }
-
+.imf{
+  line-height: 5 !important;
+  width: 0.4271rem;
+  height: 0.2708rem;
+  line-height: .3542rem;
+  font-size: .0729rem;
+}
+.imf p{
+  font-size: .0729rem;
+  margin-left: 0.0521rem;
+}
 .el-dialog__wrapper,
 .el-overlay-dialog {
     pointer-events: none;

+ 25 - 11
src/view/index/first-left.vue

@@ -86,7 +86,9 @@
             <div id="line" style="width: 1.526rem;height:1.03rem;"></div></div>
             <div class="zongji"  v-if="props.classradio=='Water'" >
                 <div class="zongjili img3">{{ heightnum }}<span>m</span></div>
-                <div class="zongjili img4"><p class="jcshijian">2024-03-20</p><p>{{ maxtime }}</p></div>
+                <div class="zongjili img4 imf">
+                  <!-- <p class="jcshijian">2024-03-20</p> -->
+                  <p>{{ maxtime.steptime }}</p></div>
               </div>
             </div>
             </div>
@@ -181,7 +183,9 @@ let currentrow1 = ref(false);
 let steptimes = ref([]);
 let series = ref([]);
 let heightnum=ref("0");
-let maxtime=ref();
+let maxtime=ref({
+  steptime:"03:02"
+});
 let jcname=ref("监测点");
 let danwei=ref();
 let state=ref();
@@ -193,6 +197,7 @@ let selelist=ref();
 let jgSelectPointId=ref(0);
 let selobj=ref([]);
 let isshow=ref(false);
+let maxindex=ref();
 
 const dynamicHeaders = ref([
 
@@ -489,15 +494,21 @@ function sliderchange(val) {
 const tableRowClassName=()=>{
 
 }
+//获取最大值的下标
 function firstOccurrenceOfMax(arr) {
-  console.log(arr);
-          if (arr.length === 0) return -1; // 空数组返回-1
-          let max = Math.max(...arr); // 找出最大值
-          console.log(max)
-          console.log(2222)
-          console.log(arr.indexOf(max));
-          return arr.indexOf(max); // 找出最大值首次出现的索引
-      }
+    var max = arr[0];
+    //声明了个变量 保存下标值
+    var index = 0;
+    for (var i = 0; i < arr.length; i++) {
+        if (max < arr[i]) {
+            max = arr[i];
+            index = i;
+        }
+    }
+    maxindex.value=index
+    return index;
+}
+
 // 随机颜色
 const randomColor=()=>{
             var letters = '0123456789ABCDEF';
@@ -545,8 +556,11 @@ const handleDelete=(event)=>{
           data:arr,//res.rows[i].data
           })
        }
-      //  firstOccurrenceOfMax(series.value[0].data)
+        firstOccurrenceOfMax(series.value[0].data)
         const max = Math.max(...series.value[0].data);
+        maxtime.value= res.steptimes[ maxindex.value];
+        console.log(maxtime.value);
+        console.log(1111)
         heightnum.value=max;
       }
       lineChart();

+ 5 - 1
src/view/index/htmldialog.vue

@@ -76,7 +76,8 @@
         </div>
       </template>
       <div>
-        <iframe :src="ifr" width="100%" height="630px" frameborder="0"></iframe>
+        <!-- <iframe :src="ifr" width="100%" height="630px" frameborder="0"></iframe> -->
+        <homeindex :water="water" :neiw="neiw"/>
       </div>
     </el-dialog>
 </template>
@@ -86,6 +87,7 @@ import { RouterView, RouterLink } from "vue-router";
 import { request, uploadFile } from "@/utils/request";
 import { ElMessage, ElButton, ElDialog, ElSelect } from "element-plus";
 import { vtkmodel } from "@/control/vtkModel.js";
+import homeindex from "@/views/home/index.vue"
 import { createFireControl } from "@/control/fireControl.js";
 import bt2 from "@/assets/img/Group 1241.png"
 let emit = defineEmits(["funidshow"]);
@@ -98,6 +100,7 @@ let iframeshow=ref(false);
 let ifr=ref();
 let X=ref(null);
 let Y=ref(null);
+let neiw=ref();
 const props = defineProps({
   isshow: {
     type: Boolean,
@@ -116,6 +119,7 @@ const getdatahtml = (val) => {
   msgval.value = val;
 };
 const tiaozhuan = (val) => {
+  neiw.value=val;
   if(val=='1'){
     ifr.value=jghrfe;
  

+ 32 - 3
src/views/home/index.vue

@@ -3,9 +3,9 @@
     <link rel="stylesheet" href="static/TemplateData/style.css">
     <link rel="manifest" href="static/manifest.webmanifest">
       <div id="unity-container">
-           <el-button @click="changeWater(0.8)">水深</el-button>
-           <el-button @click="changeCamera(1)">内部</el-button>
-           <el-button @click="changeCamera(0)">外部</el-button>
+           <!-- <el-button @click="changeWater(props.water)">水深</el-button>
+           <el-button @click="changeCamera(props.neiw)">内部</el-button>
+           <el-button @click="changeCamera(props.neiw)">外部</el-button> -->
       <canvas id="unity-canvas"></canvas>
       <div id="unity-loading-bar">
         <div id="unity-logo"></div>
@@ -18,6 +18,16 @@
     </div>
 </template>
 <script setup>
+const props = defineProps({
+  water: {
+    type: Number,
+    // required: true,
+  },
+  neiw: {
+    type: String,
+    // required: true,
+  },
+});
 onMounted(() => {  
       window.addEventListener("load", function () {
         if ("serviceWorker" in navigator) {
@@ -105,14 +115,33 @@ onMounted(() => {
  * lv 水深
  */
 function changeWater(lv){
+  console.log(lv)
     window.postMessage('changeWater:'+lv);
 }
 /**
  * lv 0 1
  */
 function changeCamera(lv){
+  console.log(lv)
      window.postMessage('changeCamera:'+lv);
 }
+
+watch(
+  () => [props.neiw,props.water],
+  (newVal, oldVal) => {
+    changeCamera(newVal[0])
+    changeWater(newVal[1])
+    console.log(1111111);
+  console.log(newVal[0],newVal[1])
+    // if (newVal[0] == '') {
+    //   htmldialogshow.value = true;
+
+    // } else {
+    //   htmldialogshow.value = false;
+    // }
+  },
+  { deep: true }
+);
 </script>
 
 <style scoped>