liuqiao 1 year ago
parent
commit
2b88a039c7

+ 13 - 5
src/view/InfoDialoges.vue

@@ -96,9 +96,13 @@
                             style="margin-top: -10px;"></el-image></div> </div>
                     <div class="ddd_div" style="display: flex;">
                         <div class="demo-input-suffix firsttitle magintop">
+                            
+                        
+
                             <el-form-item label="事故名称">
-                                <el-input v-model="formull.name" class="w-50 m-2" maxlength="18"   :placeholder="placeholder" />
+                                <el-input v-model="formull.name"   class="w-50 m-2"  @change='change2($event)'  maxlength="18"   :placeholder="placeholder" />
                             </el-form-item>
+                   
                             <div class="l_btn class_btn" style="width: auto;">
 
                                 <div class="footerbtn">
@@ -441,6 +445,7 @@ let shiguobj = ref({
     type: '预演',
     sid: '-1'
 })
+
 let sgdata = ref({});
 let formull = ref({
     source: '',
@@ -830,7 +835,6 @@ const rewu=()=>{
            // ElMessage.error(err.returnMsg)
            //state.value='0';
            sessionStorage.setItem("state",'0');
-        console.log("我是错误的state")
            emit('resulysucss');
            addinitial();
         })
@@ -977,12 +981,12 @@ const websocketonmessage = (res) => {
     if(res.data=="求解——————————————————成功"){    
      emit('websockfrist');
     }
-    reset();
+ reset();
 };
 // Websoket连接错误事件
 const websocketonerror = (res) => {
     console.log("连接错误", res);
-    reconnect();
+    reconnect
     websock.value.close();
   
 };
@@ -1017,6 +1021,7 @@ const start = () => {
     times.value.serverTimeoutObj && clearTimeout(times.value.serverTimeoutObj);
     times.value.timeoutObj = setTimeout(function () {
         //这里发送一个心跳,后端收到后,返回一个心跳消息
+        console.log(websock.readyState)
         if (websock.readyState == 1) {
             //如果连接正常
             websock.send("heartCheck");
@@ -1045,7 +1050,10 @@ onMounted(() => {
 
    // dialogVisible.value=true;
 });
-
+const change2=(val)=>{
+    console.log(val)
+    formull.value.name.forceUpdate();
+}
 defineExpose({ monitor, accident2, leftcoll, classradio, aid, dialogVisible ,changeModel,classclick,state});
 </script>
 <style scoped>

+ 8 - 95
src/view/components/InfoBoundary.vue

@@ -161,95 +161,7 @@
          </div> 
     </el-aside>
     </div>
-    <!-- 瓦斯爆炸 -->
-    <div class="common-layout" style="margin: 0">
-      <el-aside
-        width="320px"
-        class="L_aside L_aside1 asideg asidegbg leftbgimg1"
-        v-show="boun.collGass"
-      >
-        <div class="demo-collapse">
-          <el-collapse v-model="coolactiveName1" accordion>
-            <!-- <el-collapse-item name="1"> -->
-              <!-- <template #title>
-                <el-icon class="iconimg Frame2" fit="contain"></el-icon>
-                火灾<el-icon class="header-icon"> </el-icon>
-              </template> -->
-              <el-collapse-item name="1" class="imgneon">
-              <template #title>
-                <el-icon class="iconimg Frame3" fit="contain"></el-icon>
-                瓦斯边界设置<el-icon class="header-icon"> </el-icon>
-              </template> 
-              <div class="asides_content">
-                <div class="jc_content tablecolor">
-                  <div class="jc_padding font12">
-                    <div class="xian btncolor tablefocus bmar">
-                      <el-table
-                        :data="ftableData"
-                        style="width: 100%"
-                        :max-height="tableHeight"
-                        :highlight-current-row="true"
-                        :row-class-name="tableRowClassName"
-                        @row-click="handleDelete($event)"
-                         :header-cell-style="{ background: 'rgba(13, 22, 57, 0) ' }"
-                      >
-                        <el-table-column prop="nid" label="节点选择" />
-                        <!-- <el-table-column prop="type" label="边界类型" /> -->
-
-                        <el-table-column
-                          label="边界类型"
-                          prop="type"
-                          align="center"
-                          width="80px"
-                        >
-                          <template #default="scope">
-                            {{
-                              scope.row.type == "massflow"
-                                ? "流量边界"
-                                : scope.row.type == "Pressure"
-                                ? "压力边界"
-                                : "压力边界"
-                            }}
-                          </template>
-                        </el-table-column>
-                        <!-- <el-table-column  width="50">
-                                                //         <template #default="scope">{{scope.row.type == massflow ? '流量边界' : scope.row.type ==	Pressure?'压力边界' }} </template>
-                                                //     </el-table-column> -->
-                        <el-table-column prop="flow" label="流量(m³/s)" width="80" />
-                        <el-table-column prop="pressure" label="压强(pa)" width="70" />
-                        <el-table-column prop="temperature" label="温度(℃)" />
-                        <el-table-column prop="polcon1" label="二氧化碳" width="95" />
-                        <el-table-column prop="polcon2" label="二氧化硫" width="95" />
-                      </el-table>
-                      <div class="asdis_btn">
-                        <div class="flex_a"   @click=" bounadd(); dialog.dialogVisible = true;">
-                          <div
-                            class="btns"
-                            :class="{tabactive: isActive === 1}" @click="changeClass(1)"
-                          >
-                            <span class="spantext">添加</span>
-                          </div>
-                        </div>
-                        <div class="flex_a" @click="xiugai()">
-                          <div class="btns"  :class="{tabactive: isActive === 2}" @click="changeClass(2)">
-                            <span class="spantext">修改</span>
-                          </div>
-                        </div>
-                        <div class="flex_a" @click="xiudelete();">
-                          <div class="btns"  :class="{tabactive: isActive === 3}" @click="changeClass(3)">
-                            <span class="spantext">删除</span>
-                          </div>
-                        </div>
-                      </div>
-                    </div>
-                  </div>
-                </div>
-              </div>
-            </el-collapse-item>
-          </el-collapse>
-        </div>
-      </el-aside>
-    </div>
+ 
     <!-- 添加 -->
     <el-dialog
       v-model="dialog.dialogVisible"
@@ -270,7 +182,7 @@
         </div>
       </template>
       <div class="addye">
-        <div class="fireclass" v-if="props.classradio == 'Fire'">
+        <div class="fireclass" v-if="props.classradio == 'Fire' ||props.classradio == 'Gass'">
           <el-form class="demo-form-inline" :inline="true" :model="bformInline">
             <div class="l_padding input" style="padding: 20px 20px 20px 24px">
               <div class="demo-input-suffix firsttitle magintop">
@@ -687,6 +599,7 @@ const projectsSelectionSelect = (selection, row) => {
 };
 //边界添加前清空
 const bounadd = () => {
+  console.log(22233444)
   bid.value = "";
   bformInline.value.nname = "";
   (bformInline.value.type = "Pressure"), (bformInline.value.flow = "0");
@@ -695,7 +608,7 @@ const bounadd = () => {
   bformInline.value.polcon1 = "0";
   bformInline.value.polcon2 = "0";
   buntext.value = "添加";
-  if (props.classradio == "Fire") {
+  if (props.classradio == "Fire" ||props.classradio == "Gass") {
     bformInline.value.type = "Pressure";
   } else if (props.classradio == "Water") {
     bformInline.value.type = "边界出口";
@@ -810,7 +723,7 @@ const tableRowClassName = ({ row, rowIndex }) => {
 const accident4 = (key) => {
   if (key == "1"||key == "2"||key == "3") {
     console.log(key);
-    if (props.classradio == "Fire") {
+    if (props.classradio == "Fire"||props.classradio =='Gass') {
       boun.value.collfire = true;
       boun.value.collwater = false;
       boun.value.collGass = false;
@@ -819,9 +732,9 @@ const accident4 = (key) => {
       boun.value.collfire = false;
       boun.value.collGass = false;
     } else if(props.classradio =='Gass'){
-      boun.value.collwater = false;
-      boun.value.collfire = true;
-      boun.value.collGass = false;
+      // boun.value.collwater = false;
+      // boun.value.collfire = true;
+      // boun.value.collGass = false;
 
     }else{
       

+ 4 - 6
src/view/components/InfoDisaster.vue

@@ -565,9 +565,8 @@
           <el-input-number
             v-model="wasi.ssite"
             :min="0"
-            :max="1"
-            :precision="2"
-            :step="0.1"
+            :max="10000"
+            :step="100"
             controls-position="right"
             class="w-50 m-2"
             placeholder="位置"
@@ -577,9 +576,8 @@
           <el-input-number
             v-model="wasi.esite"
             :min="0"
-            :max="1"
-            :precision="2"
-            :step="0.1"
+            :max="10000"
+            :step="100"
             controls-position="right"
             class="w-50 m-2"
             placeholder="位置"

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

@@ -112,6 +112,7 @@ let jghrfe=ref();
 let jghrfe2=ref();
 let url;
 const getdatahtml = (val) => {
+  console.log(val);
   water.value = Number(val[0].value) / 4;
   console.log(water.value);
   jghrfe=url+"static/index.html?camera=1&water="+ water.value;

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

@@ -30,7 +30,7 @@ const props = defineProps({
     // default: '',activeIndex
   },
   aid: {
-    type: String,
+    type: Number,
     // default: '',activeIndex
   },
   state: {

+ 1 - 1
src/view/result.vue

@@ -61,7 +61,7 @@
   <!-- 物理量 -->
   <div class="heigjie">
         <div class="he_pading1 color1">
-          <el-form-item label="物理量:" v-if="props.classradio == 'Fire'">
+          <el-form-item label="物理量:" v-if="props.classradio == 'Fire'||props.classradio == 'Gass'">
             <el-select v-model="formInline.region" @change="regionchange($event)" placeholder="请选择">
               <el-option v-for="item in strResultFormatlist" :key="item.id" :label="item.name"
                 :value="item.value"></el-option>

+ 36 - 0
src/views/home/config.js

@@ -0,0 +1,36 @@
+function unityShowBanner(msg, type) {
+    function updateBannerVisibility() {
+      warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
+    }
+    var div = document.createElement('div');
+    div.innerHTML = msg;
+    warningBanner.appendChild(div);
+    if (type == 'error') div.style = 'background: red; padding: 10px;';
+    else {
+      if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
+      setTimeout(function() {
+        warningBanner.removeChild(div);
+        updateBannerVisibility();
+      }, 5000);
+    }
+    updateBannerVisibility();
+  }
+  var buildUrl = "static/Build";
+  var loaderUrl = "static/Build/BuildFast.loader.js";
+export const config = {
+    dataUrl: buildUrl + "/BuildFast.data",
+    frameworkUrl: buildUrl + "/BuildFast.framework.js",
+    codeUrl: buildUrl + "/BuildFast.wasm",
+    streamingAssetsUrl: "StreamingAssets",
+    companyName: "DefaultCompany",
+    productName: "CollierySafety",
+    productVersion: "0.1.0",
+    showBanner: unityShowBanner,
+  };
+  // By default Unity keeps WebGL canvas render target size matched with
+  // the DOM size of the canvas element (scaled by window.devicePixelRatio)
+  // Set this to false if you want to decouple this synchronization from
+  // happening inside the engine, and you would instead like to size up
+  // the canvas DOM size and WebGL render target sizes yourself.
+  // config.matchWebGLToCanvasSize = false;
+

+ 150 - 0
src/views/home/home.vue

@@ -0,0 +1,150 @@
+<template>
+    <link rel="shortcut icon" href="static/TemplateData/favicon.ico">
+    <link rel="stylesheet" href="static/TemplateData/style.css">
+    <link rel="manifest" href="static/manifest.webmanifest">
+      <div id="unity-container">
+           <!-- <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>
+        <div id="unity-progress-bar-empty">
+          <div id="unity-progress-bar-full"></div>
+        </div>
+      </div>
+      <div id="unity-warning"> </div>
+     
+    </div>
+</template>
+<script setup>
+import { config } from './config.js';
+const props = defineProps({
+  water: {
+    type: Number,
+    // required: true,
+  },
+  neiw: {
+    type: String,
+    // required: true,
+  },
+});
+onMounted(() => {  
+      window.addEventListener("load", function () {
+        if ("serviceWorker" in navigator) {
+         navigator.serviceWorker.register("static/ServiceWorker.js");
+        }
+      });
+      var container = document.querySelector("#unity-container");
+      var canvas = document.querySelector("#unity-canvas");
+      var loadingBar = document.querySelector("#unity-loading-bar");
+      var progressBarFull = document.querySelector("#unity-progress-bar-full");
+      var warningBanner = document.querySelector("#unity-warning");
+
+      // Shows a temporary message banner/ribbon for a few seconds, or
+      // a permanent error message on top of the canvas if type=='error'.
+      // If type=='warning', a yellow highlight color is used.
+      // Modify or remove this function to customize the visually presented
+      // way that non-critical warnings and error messages are presented to the
+      // user.
+      // function unityShowBanner(msg, type) {
+      //   function updateBannerVisibility() {
+      //     warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
+      //   }
+      //   var div = document.createElement('div');
+      //   div.innerHTML = msg;
+      //   warningBanner.appendChild(div);
+      //   if (type == 'error') div.style = 'background: red; padding: 10px;';
+      //   else {
+      //     if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
+      //     setTimeout(function() {
+      //       warningBanner.removeChild(div);
+      //       updateBannerVisibility();
+      //     }, 5000);
+      //   }
+      //   updateBannerVisibility();
+      // }
+
+      var buildUrl = "static/Build";
+       var loaderUrl = buildUrl + "/BuildFast.loader.js";
+      // var config = {
+      //   dataUrl: buildUrl + "/BuildFast.data",
+      //   frameworkUrl: buildUrl + "/BuildFast.framework.js",
+      //   codeUrl: buildUrl + "/BuildFast.wasm",
+      //   streamingAssetsUrl: "StreamingAssets",
+      //   companyName: "DefaultCompany",
+      //   productName: "CollierySafety",
+      //   productVersion: "0.1.0",
+      //   showBanner: unityShowBanner,
+      // };
+
+      // By default Unity keeps WebGL canvas render target size matched with
+      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
+      // Set this to false if you want to decouple this synchronization from
+      // happening inside the engine, and you would instead like to size up
+      // the canvas DOM size and WebGL render target sizes yourself.
+      // config.matchWebGLToCanvasSize = false;
+
+      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
+        // Mobile device style: fill the whole browser client area with the game canvas:
+        var meta = document.createElement('meta');
+        meta.name = 'viewport';
+        meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
+        document.getElementsByTagName('head')[0].appendChild(meta);
+      }
+
+      loadingBar.style.display = "block";
+
+      var script = document.createElement("script");
+      script.src = loaderUrl;
+      script.onload = () => {
+        createUnityInstance(canvas, config, (progress) => {
+          progressBarFull.style.width = 100 * progress + "%";
+        }).then((unityInstance) => {
+          loadingBar.style.display = "none";
+        }).catch((message) => {
+          alert(message);
+        });
+      };
+      document.body.appendChild(script);
+
+
+
+});
+
+/**
+ * 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>
+
+</style>